How to delete a data source (ODBC)

How to Install SQL Server 2000

How To

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.

To delete a data source by using ODBC Administrator

  1. On the Start menu, point to Settings, and then click Control Panel.

  2. Double-click 32bit ODBC.

  3. Click the User DSN, System DSN, or File DSN tab.

  4. Click the data source to delete.

  5. Click Remove, and then confirm the deletion.

To delete a user or system data source programmatically

  • Call SQLConfigDataSource with the fOption parameter set to either ODBC_REMOVE_DSN or ODBC_REMOVE_SYS_DSN.

To delete a file data source

  1. On the Start menu, point to Settings, and then click Control Panel.

  2. Double-click 32bit ODBC.

  3. Click the File DSN tab.

  4. Click the file DSN to delete.

  5. Click Remove.
Examples

This example shows data source removal by using SQLConfigDataSource. It has been simplified by removing error checking.

#include <stdio.h>
#include <windows.h>
#include "sql.h"
#include <odbcinst.h>

int main() {

RETCODE retcode;

UCHAR   *szDriver = "SQL Server";
UCHAR   *szAttributes = "DSN=MyFileDSN";

retcode = SQLConfigDataSource(NULL,
                       ODBC_REMOVE_DSN,
                       szDriver,
                       szAttributes);
}

See Also

Deleting a Data Source