Tony86
Posts: 2
Joined: Thu Jun 10, 2021 10:45 am

Re-populate databases into Combo Box after incorrect credentials

Fri Jun 11, 2021 12:47 pm

Hi,

I'm using SQL Database Browse functionality to populate a combo box when it is pressed. Similar to what's in this post
It is working as expected when authentication information is correct.

Problem is when user typed in incorrect credentials, pressed the combo box, met with the error dialog, typed in the correct credentials then pressed the combo box but nothing happened. I guess it is due to Windows Installer not automatically refresh combo box control without switching to a different dialog as stated here.

How can I make it to repopulate databases into the combo box after user has corrected the credentials information?

Another question: When executing ShowDatabases with incorrect credentials, user is met with error "ODBC Connect: timeout exceeded." instead of something like "Login failed for user ..". Is there a way to have it display the correct error similar to when using the "Test Connection" button ?

I'm using AI 16.7 Architect.

Best regards,
Tony

Catalin
Posts: 4224
Joined: Wed Jun 13, 2018 7:49 am

Re: Re-populate databases into Combo Box after incorrect credentials

Mon Jun 14, 2021 5:06 pm

Hello Tony and welcome to our forums,
How can I make it to repopulate databases into the combo box after user has corrected the credentials information?
This could be done by adding a "Refresh the current dialog" event on the button that executes the query for the databases, i.e.:
Refresh.png
Refresh.png (120.77 KiB) Viewed 2781 times
Another question: When executing ShowDatabases with incorrect credentials, user is met with error "ODBC Connect: timeout exceeded." instead of something like "Login failed for user ..". Is there a way to have it display the correct error similar to when using the "Test Connection" button ?
It is indeed true that the given message may not be the most helpful for a first time user, but I'm afraid it may not be possible to change it since it is given by the ODBC driver itself (it is not a custom message).

P.S.: Regarding your first question, are you by any chance trying to connect to MSSQL databases? If that is the case, please note that you could use the "SQLServerConnectionDlg" dialog. This is a custom dialog that we have created, specifically for SQL Server (not for MySQL), that does every configuration autoamtically (i.e. database browse, server browse, etc.). In the screenshot above, I have used that dialog and the refresh event is added automatically.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Tony86
Posts: 2
Joined: Thu Jun 10, 2021 10:45 am

Re: Re-populate databases into Combo Box after incorrect credentials

Tue Jun 15, 2021 1:04 pm

Thank you for your response.

I'm using SQLServerConnectionDlg and I can do like your instruction.

My question, however, is how do that without using the "browse" button. Please see my attached screenshot below.

I think I got it.

P/S: After testing I think I'll have to go with the browse button like you did. The reason is that with my setup the databases list is only populated once. If the user sees the list of databases then realizes that he needs to look up in another server then there is no way to force the dialog to repopulate database list.
Attachments
database.png
database.png (143.46 KiB) Viewed 2772 times

Catalin
Posts: 4224
Joined: Wed Jun 13, 2018 7:49 am

Re: Re-populate databases into Combo Box after incorrect credentials

Tue Jun 15, 2021 3:01 pm

Hello Tony,

Thank you for your followup on this!

I understand your scenario now, but yes, as you have mentioned, I believe it would be best to use the "Browse" button, as it is by default.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”