|
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(Ol eDbConnectionString
constr, OleDbConnection connection)\r\n at
System.Data.OleDb.OleDbConnectionFactory.CreateCon nection(DbConnectionOptions
options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection
owningObject)\r\n at
System.Data.ProviderBase.DbConnectionFactory.Creat eNonPooledConnection(DbConnection
owningConnection, DbConnectionPoolGroup poolGroup)\r\n at
System.Data.ProviderBase.DbConnectionFactory.GetCo nnection(DbConnection
owningConnection)\r\n at
System.Data.ProviderBase.DbConnectionClosed.OpenCo nnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory)\r\n at
System.Data.OleDb.OleDbConnection.Open()\r\n at
System.Data.Common.DbDataAdapter.FillInternal(Data Set 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" | |
Share:
|
Check this : http://blogs.wdevs.com/Gaurang/archi...6/15/5112.aspx
Brad wrote:
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(Ol eDbConnectionString
constr, OleDbConnection connection)\r\n at
System.Data.OleDb.OleDbConnectionFactory.CreateCon nection(DbConnectionOptions
options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection
owningObject)\r\n at
System.Data.ProviderBase.DbConnectionFactory.Creat eNonPooledConnection(DbConnection
owningConnection, DbConnectionPoolGroup poolGroup)\r\n at
System.Data.ProviderBase.DbConnectionFactory.GetCo nnection(DbConnection
owningConnection)\r\n at
System.Data.ProviderBase.DbConnectionClosed.OpenCo nnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory)\r\n at
System.Data.OleDb.OleDbConnection.Open()\r\n at
System.Data.Common.DbDataAdapter.FillInternal(Data Set 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"
| | |
I'd say you want something like this
select * from [Sheet1]
Its the name of the SHEET (bottom left) when you have the excel file open in
the program Microsoft Excel.
Its not the name of the DataSet.
"Brad" <br************@roche.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
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(Ol eDbConnectionString
constr, OleDbConnection connection)\r\n at
System.Data.OleDb.OleDbConnectionFactory.CreateCon nection(DbConnectionOption
s
options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection
owningObject)\r\n at
System.Data.ProviderBase.DbConnectionFactory.Creat eNonPooledConnection(DbCon
nection
owningConnection, DbConnectionPoolGroup poolGroup)\r\n at
System.Data.ProviderBase.DbConnectionFactory.GetCo nnection(DbConnection
owningConnection)\r\n at
System.Data.ProviderBase.DbConnectionClosed.OpenCo nnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory)\r\n at
System.Data.OleDb.OleDbConnection.Open()\r\n at
System.Data.Common.DbDataAdapter.FillInternal(Data Set 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"
| | |
That was exactly my problem! Thanks for saving me the time on google!
Brad
"Tasos Vogiatzoglou" <tv*****@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
Check this : http://blogs.wdevs.com/Gaurang/archi...6/15/5112.aspx
Brad wrote:
>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(O leDbConnectionString constr, OleDbConnection connection)\r\n at System.Data.OleDb.OleDbConnectionFactory.CreateCo nnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)\r\n at System.Data.ProviderBase.DbConnectionFactory.Crea teNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)\r\n at System.Data.ProviderBase.DbConnectionFactory.GetC onnection(DbConnection owningConnection)\r\n at System.Data.ProviderBase.DbConnectionClosed.OpenC onnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)\r\n at System.Data.OleDb.OleDbConnection.Open()\r\n at System.Data.Common.DbDataAdapter.FillInternal(Dat aSet 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"
| | This discussion thread is closed Replies have been disabled for this discussion. Similar topics
reply
views
Thread by David Alliet |
last post: by
|
1 post
views
Thread by mail2atulmehta@yahoo.com |
last post: by
|
1 post
views
Thread by Turner, GS \(Geoff\) |
last post: by
|
4 posts
views
Thread by Phoebe. |
last post: by
|
5 posts
views
Thread by Scott M. Lyon |
last post: by
|
9 posts
views
Thread by dba123 |
last post: by
|
3 posts
views
Thread by Bharathi |
last post: by
| | | | | | | | | | | | |