Codename K
Posts: 471
Joined: Fri Jan 29, 2010 3:04 pm

Combo box populating wrong SQL Server instances?

Fri Jun 04, 2021 6:03 pm

Hello,

In SQL Databases section you can add in the SQL Server Browse to populate SQL Server instances to a combo box. This works fine. But in one computer, it also populates the term "(local)" and that is the first item selected in combo box. Because of this reason, when you go to the SQLServerConnectionDlg it shows an error message. How to fix this?

Also in combo box with SQL Server instances populated, how to make it always show specific server name?

:?:
K

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

Re: Combo box populating wrong SQL Server instances?

Mon Jun 07, 2021 7:15 pm

Hello K,

I am not quite sure I understand what the issue is here.

The output of the server query should look something as it follows:

LOCATION\INSTANCE_NAME

in your case, (local) meaning that the instance name is on the local machine. It shows the same output on my machine as well (I only have one SQL Server Instance):
local.png
local.png (80.94KiB)Viewed 10704 times
Because of this reason, when you go to the SQLServerConnectionDlg it shows an error message
Could you please give me some more details about this? What is the encountered error?

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

Codename K
Posts: 471
Joined: Fri Jan 29, 2010 3:04 pm

Re: Combo box populating wrong SQL Server instances?

Sun Aug 22, 2021 8:29 pm

Hello,

I am sorry for the very late reply. But here is the issue,

I am assuming when you install SQL Server 2019 Developer while SQL Server 2017 Express, or install with the SQL instance name "MSSQLSERVER", and then you populate the SQL instances it also populates the term "(local)" and that is the first item selected in combo box. However, this may confuse the end-users.

What I required was to only populate the SQL instances listed in this registry key,

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL

This can be achieved by selecting Local SQL Browser from Browser type. However, this also populate just "(local)". So in order to prevent it from populating this, I created a VBScript in custom action to read the registry entries of the registry key above and populate using the Populate combo box custom action to another combo box.

So is there a function in Advanced Installer to populate the SQL instances using SQL Server Browse and discard certain values?

For example: if the SQL list contained these,

(local)
(local)\SQLEXPRESS1
(local)\SQLEXPRESS2
(local)\SQLEXPRESS3

Then we have the function to only show these instead,

(local)\SQLEXPRESS1
(local)\SQLEXPRESS2

:?:
K

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

Re: Combo box populating wrong SQL Server instances?

Mon Aug 23, 2021 4:28 pm

Hello,

Thank you for your followup on this and no worries about the delayed reply!

Your scenario is now more clear for me.

Unfortunately, I'm afraid we do not have built-in support for what you need. The "SQL Server Browse" action will populate the combobox with all the instances that are present on the machine.

The workaround for this would be the one you have presented. In the custom action, you can discard any instance.

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

Codename K
Posts: 471
Joined: Fri Jan 29, 2010 3:04 pm

Re: Combo box populating wrong SQL Server instances?

Mon Aug 23, 2021 5:48 pm

Hello,

I understand and thank you.
K

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

Re: Combo box populating wrong SQL Server instances?

Mon Aug 23, 2021 6:06 pm

You are always welcome!

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

Return to “Common Problems”