|
|
|
How do I connect to an Excel Spreadsheet ?
Many people have difficulty connecting through ODBC to an Excel Spreadsheet. The following connection string uses OLEDB to connect to a speadsheet in the private directory of a site:
strconn = "DRIVER=Microsoft Excel Driver ({use star character}.xls);
UID=admin;
UserCommitSync=Yes;
Threads=3;
SafeTransactions=0;
ReadOnly=1;
PageTimeout=5;
MaxScanRows=8;
MaxBufferSize=2048;
FIL=excel 8.0;
DriverId=790;
DefaultDir=" + Server.MapPath("..\..\private") + ";
DBQ=" + Server.MapPath("..\..\private\test.xls") + ";"
Notes:
1. Server.MapPath is used to get the absolute path.
2. No ODBC link needs to be created. This is pure code based database connectivity.
3. You should only read from Excel Spreadsheets through this type od connection.
|
|
|