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

Problem creating SQL Server database

Hello,

I have Advanced Installer 12.1.

I have added a SQL Server dialog box to be shown to user when he is installing the application. That dialog has a listbox that shows the SQL Server servers, a checkbox whose name is SqlTrustedConnection and 2 simple edit controls, both for username and password.

When creating database in database page in Advanced Installer, I did not check Trusted Connection checkbox because this should be selected at install time, by mean of SqlTrustedConnection property.

Well... the problem is that when installing, I check the SqlTrustedConnection property leaving blank the simple edit controls but when database is to be created, a "CREATE DATABASE permission denied in database 'master'" is shown.

it is not problem of current logged in user, since when I use SQL Management Studio to create the database, it works.

Any help will be appreciated, thanks

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

Re: Problem creating SQL Server database

I have found that if checkbox is unchecked from start and then I check it, it works.

Is there a way for the system to set that property to 1 if checkbox starts checked?
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Problem creating SQL Server database

Hello Jaime,

I'm not sure I fully understand the workflow you are currently testing without success. To get a clear view of your current scenario can you please send us the AIP (project file) and a detailed step by step test case to support at advancedinstaller dot com so we can investigate this on our side?

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jstuardo
Posts: 87
Joined: Mon Nov 09, 2015 10:44 pm

Re: Problem creating SQL Server database

Hello...

I am attaching the AIP file in this forum.... I prefer here than by e-mail.

The problem is simple stated this way:

If you see SQLServerDlg dialog, present in First Time install, you will see a checkbox whose property name is "SqlTrustedConnection".

If I check that checkbox at design time, and then run the installer, SQL Server cnnection does not recognize I am using trusted connection. On the other hand, if I leave that checkbox unchecked and check it at install time, SQL Server connection does recognize trusted connection, creating the whole database structure.

Regards
Jaime
Attachments
setup.aip
(63.31 KiB) Downloaded 295 times
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Problem creating SQL Server database

Hello Jaime,

I've tested the scenario but I cannot replicate the behavior. A trusted connection (Windows authentication) is always established as long as you don't type anything in the "Username" and "Password" fields from your "SQLServerDlg" dialog.

When you do set the username and password fields the "SqlTrustedConnection" checkbox state will be ignored and always an SQL connection will be established. To avoid this behavior you can add two control conditions on the username and password fields to be disabled when "SqlTrustedConnection" property is set. Just add the following control conditions
  • Condition: NOT SqlTrustedConnection
    Action: Enable

    Condition: SqlTrustedConnection
    Action: Disable
on both username and password fields.

Then, on the [Next] button of the same dialog add two published events like this:

  • Event: Set installer property value
    Property: USERNAME_PROP
    Argument: {}
    Condition: SqlTrustedConnection

    Event: Set installer property value
    Property: PASSWORD_PROP
    Argument: {}
    Condition: SqlTrustedConnection

The above published events will reset the username and password properties to no value when the "SqlTrustedConnection" is used.

Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”