Skip to content

Commit

Permalink
ODBC-87 Db combobox lost the selection after Test
Browse files Browse the repository at this point in the history
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 18ea7d4
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions dsn/odbc_dsn.c
Expand Up @@ -379,6 +379,7 @@ void DSN_Set_Database(SQLHANDLE Connection)
SQLRETURN ret= SQL_ERROR;
char Database[65];
MADB_Dsn *Dsn= (MADB_Dsn *)GetWindowLongPtr(GetParent(hwndTab[0]), DWLP_USER);
HWND DbCombobox= GetDlgItem(hwndTab[1], cbDatabase);


if (DBFilled)
Expand All @@ -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));
ComboBox_ResetContent(DbCombobox);
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;

end:
Expand Down

0 comments on commit 18ea7d4

Please sign in to comment.