SQLRemoveDSNFromIni Function

Version Introduced: ODBC 1.0

SQLRemoveDSNFromIni removes a data source from the system information.


BOOL SQLRemoveDSNFromIni(  
     LPCSTR   lpszDSN);  


[Input] Name of the data source to remove.


The function returns TRUE if it removes the data source or the data source was not in the Odbc.ini file. It returns FALSE if it fails to remove the data source.


When SQLRemoveDSNFromIni returns FALSE, an associated *pfErrorCode value can 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.

*pfErrorCode Error Description
ODBC_ERROR_GENERAL_ERR General installer error An error occurred for which there was no specific installer error.
ODBC_ERROR_INVALID_DSN Invalid DSN The lpszDSN argument was invalid.
ODBC_ERROR_REQUEST_FAILED Request failed The installer could not remove the DSN info from the registry.
ODBC_ERROR_OUT_OF_MEM Out of memory The installer could not perform the function because of a lack of memory.


SQLRemoveDSNFromIni removes the data source name from the [ODBC Data Sources] section of the system information. It also removes the data source specification section from the system information.

This function should be called only from a driver setup library.

For information about See
Adding, modifying, or removing a data source ConfigDSN
Adding, modifying, or removing a data source SQLConfigDataSource
Removing the default data source SQLRemoveDefaultDataSource
Adding a data source name to the system information SQLWriteDSNToIni