|
|
6.1 SQLConfigDataSource
The following specification of SQLConfigDataSource is from the Microsoft ODBC SDK Reference.
SQLConfigDataSource adds, modifies, or deletes data sources.
BOOL SQLConfigDataSource( HWND hwndParent, WORD fRequest, LPCSTR lpszDriver, LPCSTR lpszAttributes);hwndParent [Input]Parent window handle. The function will not display any dialog boxes if the handle is null.
fRequest [Input]fRequest must contain one of the following values:
ODBC_ADD_DSN: Add a new user data source.
ODBC_CONFIG_DSN: Configure (modify) an existing user data source.
ODBC_REMOVE_DSN: Remove an existing user data source.
ODBC_ADD_SYS_DSN: Add a new system data source.
ODBC_CONFIG_SYS_DSN: Modify an existing system data source.
ODBC_REMOVE_SYS_DSN: Remove an existing system data source.
ODBC_REMOVE_DEFAULT_DSN: Remove the default data source specification section from the system information. It also removes the default driver specification section from the ODBCINST.INI entry in the system information.
(This fRequest performs the same function as the deprecated SQLRemoveDefaultDataSource function.)
When this option is specified, all of the other parameters in the call to SQLConfigDataSource should be NULLs. If they are not NULL, they will be ignored.lpszDriver [Input]Driver description (usually the name of the associated DBMS) presented to users instead of the physical driver name.
lpszAttributes [Input]List of attributes in the form of keyword-value pairs.
The function returns TRUE if it is successful, FALSE if it fails.
If no entry exists in the system information when this function is called, the function returns FALSE.
When SQLConfigDataSource returns FALSE, an associated *pfErrorCode value may be obtained by calling SQLInstallerError.
The following table lists the *pfErrorCode values that can be returned by SQLInstallerError and explains each one in the context of this function.
Error
Description
SQLConfigDataSource uses the value of lpszDriver to read the full path of the setup DLL for the driver from the system information. It loads the DLL and calls ConfigDSN with the same arguments that were passed to it.
SQLConfigDataSource returns FALSE if it is unable to find or load the setup DLL, or if the user cancels the dialog box. Otherwise, it returns the status it received from ConfigDSN.
|
Mimer Information Technology AB Voice: +46 18 780 92 00 Fax: +46 18 780 92 40 info@mimer.se |
|
|