B
Brad
I'm having a problem reading data from an Excel file into a dataset. Can
anybody give me an idea of what's happening? I've included the problematic
source and the error message to the end of this message.
TIA
Brad
Here's a snippet of my source code:
//Retrieve data from the Excel spreadsheet file
string myConnectionString;
OleDbConnection myConnection;
OleDbDataAdapter myAdapter;
DataSet myDataSet = new DataSet("XLS");
myConnectionString = "provider=Microsoft.Jet.OLEDB.4.0;data source=" +
FileName + ";Extended Properties=Excel 8.0;HDR=Yes;IMEX=1";
myConnection = new OleDbConnection(myConnectionString);
myAdapter = new OleDbDataAdapter("select * from [Dataset$]", myConnection);
myAdapter.Fill(myDataSet);
myConnection.Close();
return (myDataSet);
}
Here's the Error Message:
"System.Data.OleDb.OleDbException: Could not find installable ISAM.\r\n at
System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString
constr, OleDbConnection connection)\r\n at
System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions
options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection
owningObject)\r\n at
System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection
owningConnection, DbConnectionPoolGroup poolGroup)\r\n at
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection
owningConnection)\r\n at
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory)\r\n at
System.Data.OleDb.OleDbConnection.Open()\r\n at
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[]
datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand
command, CommandBehavior behavior)\r\n at System.Data.Common.DbDataAdapte
r.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String
srcTable, IDbCommand command, CommandBehavior behavior)\r\n at
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)\r\n at
RD.DBLoad.ERD.CoSo.MeterData.Read() in
F:\\Projects\\DbLoad_Solution\\RD.DBLoad.ERD\\ERD\\CoSo\\MeterData.cs:line
90"
anybody give me an idea of what's happening? I've included the problematic
source and the error message to the end of this message.
TIA
Brad
Here's a snippet of my source code:
//Retrieve data from the Excel spreadsheet file
string myConnectionString;
OleDbConnection myConnection;
OleDbDataAdapter myAdapter;
DataSet myDataSet = new DataSet("XLS");
myConnectionString = "provider=Microsoft.Jet.OLEDB.4.0;data source=" +
FileName + ";Extended Properties=Excel 8.0;HDR=Yes;IMEX=1";
myConnection = new OleDbConnection(myConnectionString);
myAdapter = new OleDbDataAdapter("select * from [Dataset$]", myConnection);
myAdapter.Fill(myDataSet);
myConnection.Close();
return (myDataSet);
}
Here's the Error Message:
"System.Data.OleDb.OleDbException: Could not find installable ISAM.\r\n at
System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString
constr, OleDbConnection connection)\r\n at
System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions
options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection
owningObject)\r\n at
System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection
owningConnection, DbConnectionPoolGroup poolGroup)\r\n at
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection
owningConnection)\r\n at
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory)\r\n at
System.Data.OleDb.OleDbConnection.Open()\r\n at
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[]
datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand
command, CommandBehavior behavior)\r\n at System.Data.Common.DbDataAdapte
r.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String
srcTable, IDbCommand command, CommandBehavior behavior)\r\n at
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)\r\n at
RD.DBLoad.ERD.CoSo.MeterData.Read() in
F:\\Projects\\DbLoad_Solution\\RD.DBLoad.ERD\\ERD\\CoSo\\MeterData.cs:line
90"