G
Guest
I am trying to read an excel file. Here is my code
string Conn ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source =
G:\\\\NA\\Stamford\\Technology\\Information
Security\\DATA_ENTITLEMENTS!\\G_Drive_Entitlements_STM_2005.xls;" +
"Exteneded Properties=Excel 8.0;";
OleDbConnection dbConn = new OleDbConnection(Conn);
dbConn.Open ();
OleDbCommand Cmd = new OleDbCommand("Select * From [Sheet1$]", dbConn);
OleDbDataAdapter Da = new OleDbDataAdapter();
Da.SelectCommand = Cmd;
DataSet Ds = new DataSet();
Da.Fill(Ds);
dg.DataSource = Ds.Tables[0];
dbConn.Close ();
I get the error here: OleDbCommand Cmd = new OleDbCommand("Select * From
[Sheet1$]", dbConn);
Please help
string Conn ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source =
G:\\\\NA\\Stamford\\Technology\\Information
Security\\DATA_ENTITLEMENTS!\\G_Drive_Entitlements_STM_2005.xls;" +
"Exteneded Properties=Excel 8.0;";
OleDbConnection dbConn = new OleDbConnection(Conn);
dbConn.Open ();
OleDbCommand Cmd = new OleDbCommand("Select * From [Sheet1$]", dbConn);
OleDbDataAdapter Da = new OleDbDataAdapter();
Da.SelectCommand = Cmd;
DataSet Ds = new DataSet();
Da.Fill(Ds);
dg.DataSource = Ds.Tables[0];
dbConn.Close ();
I get the error here: OleDbCommand Cmd = new OleDbCommand("Select * From
[Sheet1$]", dbConn);
Please help