jstuardo
Posts: 88
Joined: Mon Nov 09, 2015 10:44 pm

How to do a conditional "Test SQL Server connection"

I am credatng an installer with version 20.5.

One of the installer dialogs allows the user to choose SQL Server parameters, among them, credentials and if it uses trusted connection.

Well....... if user chooses trusted connection, and then click next in that dialog, installer tries to test the connection not using the user selection but using a fixed connection string.

This is the test connection page:
Test connection.png
Test connection.png (30.51 KiB) Viewed 9636 times
As you can see, the connection string is fixed. How can I make it conditionaly depending on the user selection?

Thanks
Jaime
Catalin
Posts: 7513
Joined: Wed Jun 13, 2018 7:49 am

Re: How to do a conditional "Test SQL Server connection"

Hello Jaime,

Please note that what you are seeing there is the default behavior of the SQL Driver.

Basically, if the Username and Password are empty, it will automatically use the "Trusted Connection".

When you set that flag at runtime, the Username and Password fields become disabled and following the logic above, the Trusted Connection will be used.

Now, if you want to execute a Test Connection conditionally, all you have to do is:

- go to SQL Databases page

- add another Test Connection custom action

- schedule it on your dialog

- go to "Dialogs" page

- find the event and condition it
Screenshot_167.png
Screenshot_167.png (17.37 KiB) Viewed 9609 times
Screenshot_168.png
Screenshot_168.png (15.01 KiB) Viewed 9609 times

Hope this helps!

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

Return to “Building Installers”