Hi all,
I need to read data from an excel file and populate a dataset.
After some search I found following code:
connString = @"Provider=Micr osoft.Jet.OLEDB .4.0;Data
Source=" +
filename.ToStri ng() +
";Extended Properties=\"Ex cel 8.0;HDR=YES;\"" ;
DataSet myDataSet = new DataSet();
OleDbDataAdapte r myCommand = new OleDbDataAdapte r(
"SELECT * FROM [Sheet1$]",
connString);
myCommand.Fill( myDataSet, "ExcelInfo" );
but in order to work, you need to know the name of the sheet you want
to read.
Is there a way to read data in the first sheet (even if you don't know
the name)?
Thanks a lot,
Danilo