SqlServerBrowseComboBox SelectedItemValue - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

mmaslenkova
Posts: 11
Joined: Fri Jun 20, 2008 1:47 pm

SqlServerBrowseComboBox SelectedItemValue

Hello,
In "SQLConnectionDlg" dialog I've put "SqlServerBrowseComboBox", which is correctly populated with network db servers. Now I'm trying to get the value of this ComboBox in the connection server field in SQl scripts, but I can't :roll: . Can you please tell me how to achieve this?


Regards: Mila
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: SqlServerBrowseComboBox SelectedItemValue

Hi Mila,

In order to get the value in the combobox you can use its property. This is set in the "Property Name" field of the Properties pane. The pane appears when you select the combobox in the Dialogs page.

For browsing the SQL Servers, the property of your combobox must be set to SqlServerBrowseComboBox. Therefore, in order to access the value in your combobox you can use the property like this:

Code: Select all

[SqlServerBrowseComboBox]
Note that this is supported only by formatted fields which accept Windows Installer properties.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mmaslenkova
Posts: 11
Joined: Fri Jun 20, 2008 1:47 pm

Re: SqlServerBrowseComboBox SelectedItemValue

That's exactly what I do, but it doesn't work!

So I tried this:
I ran the msi in comand prompt with:

Code: Select all

msiexec /i test.msi /lvx test.log
to generate log file and I noticed that in the conneciton string in the log file - there is no server name:

Code: Select all

MSI (c) (98:AC) [15:52:10:194]: PROPERTY CHANGE: Adding SqlServerBrowseComboBox property. Its value is 'MILA'.
MSI (c) (98:AC) [15:52:17:244]: PROPERTY CHANGE: Adding DATABASE_PROP property. Its value is 'TestDB'.
MSI (c) (98:AC) [15:52:18:866]: PROPERTY CHANGE: Adding USERNAME_PROP property. Its value is 'sa'.
MSI (c) (98:AC) [15:52:21:069]: PROPERTY CHANGE: Adding PASSWORD_PROP property. Its value is '**********'.
...........................................
......................
MSI (s) (94!80) [15:52:42:730]: PROPERTY CHANGE: Adding AI_SqlConfig property. Its value is 'FMCDataConnection0SQL Server1433TestDBsa4B99BEA46060FMCDataIndTablesFMCDataConnection1GOUSE [TestDB]
GO
and it alway runs the scripts on the local db server although I select other server on the network from the combobox. That's why I first decided that the value of

Code: Select all

[SqlServerBrowseComboBox]
is not correctly retrieved but I'm not so sure anymore. So that's my problem.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: SqlServerBrowseComboBox SelectedItemValue

Hi,

I'm not sure why you are encountering this behavior. Can you please send us the AIP you are using to support at advancedinstaller dot com so we can investigate it?

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mmaslenkova
Posts: 11
Joined: Fri Jun 20, 2008 1:47 pm

Re: SqlServerBrowseComboBox SelectedItemValue

Don't you need application extensions files and all the files that are in the application folder?! I tried on other computer to open .aip file without the others and I couldn't. Anyway I have sent the .aip file along with the script I'm running (It's just sample). You will have to set up the SQL script file path.


Regards: Mila
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: SqlServerBrowseComboBox SelectedItemValue

Hi Mila,

The property was empty in the script because the script runs in a different stage of the installation. Since "SqlServerBrowseComboBox" is a private property, it cannot be passed to the "InstallExecuteSequence" stage (which runs the script).

The solution is to set a public property to the value of the "SqlServerBrowseComboBox" property. This can be done through a SetProperty Published control event for the "Next" button on the "SQLConnectionDlg" dialog.

I also noticed a mistake in the SetProperty control event you are using. You need to set the "SqlServerBrowseMethod" property to "2", but you are setting the "BrowseSqlServers" property instead. The Init control events should look like this:

Code: Select all

[SqlServerBrowseMethod]        2                           1
DoAction                       BrowseSqlServers            1
Also, you should add this Published control event on the "Next" button of the "SQLConnectionDlg" dialog:

Code: Select all

[SERVER_PROP]        [SqlServerBrowseComboBox]       1
This will set the "SERVER_PROP" public property to the value of the "SqlServerBrowseComboBox" property.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mmaslenkova
Posts: 11
Joined: Fri Jun 20, 2008 1:47 pm

Re: SqlServerBrowseComboBox SelectedItemValue

Hi Cosmin,

Thank you very much for the help - it is now working and may be it is good if you put this tip somewhere in the product help.

I have new question for you - what transaction isolation level is used in the transaction in sql scripts - i didn't see how i can configure them. I managed to achieve - dead lock :? .

Regards: Mila
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: SqlServerBrowseComboBox SelectedItemValue

Hi,
what transaction isolation level is used in the transaction in sql scripts
In order to create a transaction you can go to the "SQL Scripts" page, right-click a connection and select the "New Transaction" context menu. After the transaction is created you can add SQL scripts under it. Note that you can find more details about the isolation level in the SQL Scripts and SQL Transactions articles in the User Guide.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”