A
ad
We can use the codes below to read the sheet name mySheet in a Exel file.
string strConn = "Provider=Microsoft.Jet.Oledb.4.0;Data Source=" +
Server.MapPath("Book1.xls") + ";Extended Properties=Excel 8.0";
OleDbConnection conn = new OleDbConnection(strConn);
OleDbDataAdapter adp = new OleDbDataAdapter("Select * from
[mySheet$]",conn);
DataSet ds = new DataSet();
.....
But if we do'nt know the sheet name, but I just want read the first sheet in
the excel file.
How can I do?
string strConn = "Provider=Microsoft.Jet.Oledb.4.0;Data Source=" +
Server.MapPath("Book1.xls") + ";Extended Properties=Excel 8.0";
OleDbConnection conn = new OleDbConnection(strConn);
OleDbDataAdapter adp = new OleDbDataAdapter("Select * from
[mySheet$]",conn);
DataSet ds = new DataSet();
.....
But if we do'nt know the sheet name, but I just want read the first sheet in
the excel file.
How can I do?