How to: Delete a Data Source (ODBC)
You can delete a data source by using ODBC Administrator, programmatically (by using SQLConfigDataSource), or by deleting a file (if a file data source name).
To delete a data source by using ODBC Administrator
In Control Panel, open Administrative Tools, and then double-click Data Sources (ODBC). Alternatively, you can run odbcad32.exe from the command prompt.
Click the User DSN, System DSN, or File DSN tab.
Click the data source to delete.
Click Remove, and then confirm the deletion.
Exemple
To programmatically delete a data source, call SQLConfigDataSource using either ODBC_REMOVE_DSN or ODBC_REMOVE_SYS_DSN as the second parameter.
The following sample shows how you can programmatically delete a data source.
// remove_odbc_data_source.cpp
// compile with: ODBCCP32.lib user32.lib
#include <stdio.h>
#include <windows.h>
#include <odbcinst.h>
int main() {
LPCSTR provider = "SQL Server";
LPCSTR dsnname = "DSN=data2";
BOOL retval = SQLConfigDataSource(NULL, ODBC_REMOVE_DSN, provider, dsnname);
printf("%d\n", retval);
}
Voir aussi
Autres ressources
Configuring the SQL Server ODBC Driver (ODBC)