Share via


SQLDriverConnect (Excel Driver)

Note

This topic provides Excel Driver-specific information. For general information about this function, see the appropriate topic under ODBC API Reference.

SQLDriverConnect enables you to connect to a driver without creating a data source (DSN).

The following keywords are supported in the connection string for all drivers: DSN, DBQ, and FIL.

The following table shows the minimum keywords required to connect to each driver, and provides an example of keyword/value pairs used with SQLDriverConnect. For a full list of DRIVERID values, see SQLConfigDataSource.

Note

If DBQ or DefaultDir is not specified for the Microsoft Excel 3.0 or 4.0 driver, the driver will connect to the current directory.

Driver Keywords Required Examples
Microsoft Excel 3.0 or 4.0 Driver, DriverID Driver={Microsoft Excel Driver (*.xls)}; DBQ=c:\temp; DriverID=278
Microsoft Excel 5.0/7.0 Driver, DriverID, DBQ Driver={Microsoft Excel Driver (*.xls)}; DBQ=c:\temp\sample.xls; DriverID=22
Microsoft Excel 97 and later Driver, DriverID, DBQ Driver={Microsoft Excel Driver (*.xls)}; DBQ=c:\temp\sample.xls; DriverID=790