Index: setupgui/ConfigDSN.c =================================================================== --- setupgui/ConfigDSN.c (revision 977) +++ setupgui/ConfigDSN.c (working copy) @@ -75,6 +75,7 @@ DataSource *ds= ds_new(); BOOL rc= TRUE; Driver *driver= NULL; + SQLWCHAR *origdsn= NULL; if (pszAttributes && *pszAttributes) { @@ -91,6 +92,7 @@ rc= FALSE; goto exitConfigDSN; } + origdsn= sqlwchardup(ds->name, SQL_NTS); } switch (nRequest) @@ -111,6 +113,10 @@ /* save datasource */ if (ds_add(ds)) rc= FALSE; + /* if the name is changed, remove the old dsn */ + if (origdsn && memcmp(origdsn, ds->name, + (sqlwcharlen(origdsn) + 1) * sizeof(SQLWCHAR))) + SQLRemoveDSNFromIni(origdsn); } break; case ODBC_REMOVE_DSN: @@ -120,6 +126,7 @@ } exitConfigDSN: + x_free(origdsn); ds_delete(ds); if (driver) driver_delete(driver);