Skip to content
Browse files

ODBC-87 Db combobox lost the selection after Test

Connection test in the setup dialog triggers reading of the database(and charset) list, and populating of the combobox. But the current DB selection was not correctly restored after that.
  • Loading branch information...
lawrinn committed Sep 13, 2019
1 parent df066bd commit 18ea7d4d73313fa79a825aca9b42fac40e2f207b
Showing with 8 additions and 5 deletions.
  1. +8 −5 dsn/odbc_dsn.c
@@ -379,6 +379,7 @@ void DSN_Set_Database(SQLHANDLE Connection)
char Database[65];
MADB_Dsn *Dsn= (MADB_Dsn *)GetWindowLongPtr(GetParent(hwndTab[0]), DWLP_USER);
HWND DbCombobox= GetDlgItem(hwndTab[1], cbDatabase);

if (DBFilled)
@@ -393,15 +394,17 @@ void DSN_Set_Database(SQLHANDLE Connection)
goto end;

SQLBindCol(Stmt, 1, SQL_C_CHAR, Database, 65, 0);
ComboBox_ResetContent(GetDlgItem(hwndTab[1], cbDatabase));
while (SQLFetch(Stmt) == SQL_SUCCESS)
ComboBox_InsertString(GetDlgItem(hwndTab[1], cbDatabase), -1, Database);
ComboBox_InsertString(DbCombobox, -1, Database);
if (Dsn->Catalog)
int Idx= ComboBox_FindString(GetDlgItem(hwndTab[2], cbDatabase), 0, Dsn->Catalog);
ComboBox_SetCurSel(GetDlgItem(hwndTab[2], cbDatabase), Idx);
int Idx= ComboBox_FindString(DbCombobox, 0, Dsn->Catalog);
ComboBox_SetCurSel(DbCombobox, Idx);
ComboBox_SetMinVisible(GetDlgItem(hwndTab[1], cbDatabase),5);
ComboBox_SetMinVisible(GetDlgItem(hwndTab[1], cbDatabase), 5);
DBFilled= TRUE;


0 comments on commit 18ea7d4

Please sign in to comment.
You can’t perform that action at this time.