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 either the User DSN, System DSN, or File DSN tab.
  4. Click the data source to delete.
  5. Click Remove; then confirm the deletion.

To delete a user or system data source programmatically

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

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.