How to read the Excel file
Posted on 2008-11-03
I want to read the Excel file from web application.
I used following process but its not working..
string connString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Test.xls;Extended Properties=""Excel 8.0;HDR=YES;""";
OleDbConnection _conn = new OleDbConnection(connString);
OleDbCommand _cmd = new OleDbCommand("Select Name,ID from [Details$] ", _conn);
OleDbDataReader _reader = _cmd.ExecuteReader();
string Name = _reader["Name"].ToString();
string ID = _reader["ID"].ToString();
The Details is the Workbook Name..
I am getting the error like
"The Microsoft Jet database engine could not find the object 'Details$'. Make sure the object exists and that you spell its name and the path name correctly..."