[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Bei Zhu [MSFT]

3/4/2005 6:39:00 PM

You can create a DSN using "Microsoft Excel Driver (*.xls) first. Then in
your connect string, instead of using Driver, DriverId, etc, you can just
put DSN="whatyoucreated".


"uiwork" <uiwork@discussions.microsoft.com> wrote in message
news:5BC288A6-4B27-4F10-941F-DEE865618E0F@microsoft.com...
> Hi
> I am trying to open a connection to excel file like that:
>
> OdbcConnection conn = new OdbcConnection();
> conn.ConnectionString = @"Driver={Microsoft Excel
> Driver(*.xls)};DriverId=790;DBQ=c:\ReportsCR\dt.xls";
> conn.Open();
>
> and I am getting following error:
>
> {"ERROR [HY000] [Microsoft][ODBC Excel Driver] Cannot open database
> '(unknown)'. It may not be a database that your application recognizes,
or
> the file may be corrupt.
>
> I added this connection to ServiceExplorer, and I can see my data in
> ServiceExplorer, but when I try to populate a DataSet, I get no data.
> Anybody has an idea why it happens and how can I fix it?