Using ODBC API Functions

Administering SQL Server

Administering SQL Server

Using ODBC API Functions

You can add an ODBC data source to connect to an instance of Microsoft® SQL Server™ by writing one of the following ODBC API functions into your application.

SQLConfigDataSource

User or system data sources can be created by an ODBC application that calls the SQLConfigDataSource function with the fRequest parameter set to either ODBC_ADD_DSN or ODBC_ADD_SYS_DSN.

SQLWriteFileDSN

A file data source can be created by an ODBC application that calls the SQLWriteFileDSN function.

SQLDriverConnect

If an application specifies the SAVEFILE keyword in the connect string of a successful call to SQLDriverConnect, a file data source is created using the information specified in the SQLDriverConnect connect string.

SQLCreateDataSource

An ODBC application can call the function SQLCreateDataSource to display an ODBC dialog box that guides a user through creating a data source.

Data sources that reference the SQL Server ODBC driver contain driver-specific information and options. When a data source is created with either SQLConfigDataSource or SQLWriteFileDSN, all of the driver-specific information is supplied through keyword-value pairs in a character string passed to the function. When a data source is created using the ODBC Data Source Administrator or SQLCreateDataSource dialog boxes, the SQL Server DSN Configuration Wizard is invoked to help you specify the driver-specific information.

See Also

SQLConfigDataSource

SQLDriverConnect

SQLPrepare