Da.fill(ds); --error

G

Guest

Here is my code
string Conn ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source =
c:\\\\G_Drive_Entitlements_STM_2005.xls;" +
"Extended 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 ();
 
J

Jon Skeet [C# MVP]

freddy said:
Here is my code
string Conn ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source =
c:\\\\G_Drive_Entitlements_STM_2005.xls;" +
"Extended 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 ();

Okay, now what's the error?
 
G

Guest

error An unhandled exception of type 'System.Data.OleDb.OleDbException'
occurred in system.data.dll

Jon Skeet said:
freddy said:
Here is my code
string Conn ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source =
c:\\\\G_Drive_Entitlements_STM_2005.xls;" +
"Extended 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 ();

Okay, now what's the error?
 
G

Guest

error --An unhandled exception of type 'System.Data.OleDb.OleDbException'
occurred in system.data.dll

Nicholas Paldino said:
Ok, so what is the error?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

freddy said:
Here is my code
string Conn ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source =
c:\\\\G_Drive_Entitlements_STM_2005.xls;" +
"Extended 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 ();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top