G
globus2410
Hi ,
I was looking for how to read an excel (xls) file when i thought to use
ado.net.
This is my code :
System.Data.OleDb.OleDbConnection dbConnection =new
System.Data.OleDb.OleDbConnection(
@"Provider=Microsoft.Jet.OLEDB.4.0;"
+ @"Data Source=myFile.xls;"
+ @"Extended Properties=""Excel 8.0;HDR=Yes;""");
dbConnection.Open();
And here's the strange thing : if I have myFile.xls open with Excel
while my code reach the .Open() method everythings is ok.
But if at that time myFile.xls is not opened (with excel) it throws a
"external table different from expected" exception.
What's happening? I don't want to use interop to read an xls file.....
Where am I wrong?
Nicola
I was looking for how to read an excel (xls) file when i thought to use
ado.net.
This is my code :
System.Data.OleDb.OleDbConnection dbConnection =new
System.Data.OleDb.OleDbConnection(
@"Provider=Microsoft.Jet.OLEDB.4.0;"
+ @"Data Source=myFile.xls;"
+ @"Extended Properties=""Excel 8.0;HDR=Yes;""");
dbConnection.Open();
And here's the strange thing : if I have myFile.xls open with Excel
while my code reach the .Open() method everythings is ok.
But if at that time myFile.xls is not opened (with excel) it throws a
"external table different from expected" exception.
What's happening? I don't want to use interop to read an xls file.....
Where am I wrong?
Nicola