ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Select Data in Worksheet 1 (https://www.excelbanter.com/excel-programming/298189-select-data-worksheet-1-a.html)

Jim M[_4_]

Select Data in Worksheet 1
 
I am able to select data from worksheet 1 if I know the sheet name...

OleDbCommand objCmdSelect =new OleDbCommand("SELECT * FROM [Sheet1$]",
objConn);

How would I just get the data from the first (primary sheet) if I do not
know the name of Sheet1$ ?

Thanks in advance!



Bob Phillips[_6_]

Select Data in Worksheet 1
 
Jim,

This self-same question was asked back in April. Here is my suggested
solution using ADOX to get that first sheet name
http://tinyurl.com/yw6dp

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Jim M" wrote in message
...
I am able to select data from worksheet 1 if I know the sheet name...

OleDbCommand objCmdSelect =new OleDbCommand("SELECT * FROM [Sheet1$]",
objConn);

How would I just get the data from the first (primary sheet) if I do not
know the name of Sheet1$ ?

Thanks in advance!






All times are GMT +1. The time now is 01:58 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com