View Full Version : Prompting for SQL Database Name after SQLLogin

07-01-2005, 01:46 PM
Since IS 11 still lacks the ability to select a SQL database after the login dialog, I tried to follow articles Q111052 and this thread http://community.installshield.com/showthread.php?t=144963 but haven't had any luck. Has anyone ever done this successfully? If so, please advise so I can get this functionality into my project.

I followed the steps but I must be doing something wrong..the script just drops out and doesn't connect up.

If anyone from IS is listening, you can't always assume a static dbname that you might want to apply scripts to..I have a situation where a server has 4 databases, but I might not want to apply the scripts to all of them right away.

07-01-2005, 04:16 PM
I'm assuming you are using a Basic MSI project as you posted in the InstallShield 11 - Windows Installer Projects forum. If this is the case, you need to write a code that will set the results to your combo box dropdown list as follows.

void CSQLServerList::AddItemsToComboBox(const tstring& strProperty, vector<tstring>& vecItems)
wsprintf(szSQL,_T("Select * FROM `ComboBox` WHERE `Property`='%s'"),strProperty.c_str());


for(int i = 0; i < vecItems.size(); i++)
MSIHANDLE hRecord = MsiCreateRecord(4);
} Note that the strProperty is a MSI property name that is associated with your combo box control.

Also, the Catalog Name is linked to the IS_SQLSERVER_DATABASE property by default. If you have multiple connections and you want to connect to different databases, you need to select a different property for each connection in the Connection|Advanced tab.

Hope this helps.
Hidenori Yamanishi
Software Developer
Macrovision Corporation

07-03-2005, 07:18 AM
Try the solution at

07-03-2005, 10:02 AM
I created an empty/blank SQL script, within the SQL View.
This enabled a number of custom actions to appear within the Execute sequence, and one within the SQLLogin dialog (ISSQLValidate...or something like that). To truly enable this functionality, you must assign the auto-created component to (at least) one Feature. This can also be accomplished from within the SQL View area.

Now, the SQL Browse functions within the SQLLogin and SQLBrowse dialogs.

One thing; the ISSQLValidate custom action, which is called from one or both of the mentioned dialogs...will use the IS_SQLSERVER_PASSWORD, IS_SQLSERVER_USERNAME, IS_SQLSERVER_SERVER, IS_SQLSERVER_DATABASE, etc...if values exist within these properties, when the ISSQLValidate (or whatever it's named) is called, the database is verified that it exists...and if it doesn't, then an empty database is created...whether you like it or not.

To get around this, I removed the ISSQLValidate CA, and disabled all other ISSQL CA's that exist within the ExecuteSequence. I have my own method of creating a SQL database, and verifying, etc...(via InstallScript CAs).

It seems like a lot of trouble just to get the SQLLogin and SQLBrowse dialogs to function with all of their inherent might...but it actually is fairly simple. Too bad documentation doesn't exist for any or all of the functionality within the IS SQL custom actions! If it does...I can't find it.

07-05-2005, 11:31 AM
Ok, I'm feeling much better now..I figured out that the oSQLServer.LoginSecure property was defaulting to a FALSE value. I added a code line to get the IS_SQLSERVER_AUTHENTICATION property and set the oSQLServer.LoginSecure property to true if IS_SQLSERVER_AUTHENTICATION returned "0". Once I did that, the setup properly displays the database list. All I had to do next was test for the existence of a specific table (since I want to display the list of databases that could belong to my product and not pick up other products' databases). Now I'm connecting up and am good to go further.

Thanks for the tips! :)


07-06-2005, 03:50 PM
Ok, now that I've gotten past that hurdle, I'd like to refine my setup a couple of different ways:

1. Currently, the SQL Login dialog box allows you to click Next WITHOUT a server selected. How can I customize the SQLLogin dialog's Next to only be enabled when a server is selected?

2. I've been told that this setup would need to be run just once typically, but there are a number of clients with multiple databases that the scripts would need to be applied to. The ideal situation is for the user to be able to choose which database(s) the scripts should be applied to, and for the SQL script actions to be applied against all selected databases.

Any thoughts about how I could go about this without re-inventing the wheel would be greatly appreciated!

07-06-2005, 04:25 PM
To enable/disable the Next button based on the value of the Server Name property, add the following conditions to the Next push button control of the SQLLogin dialog in the Dialog|Behavior view.

Action: Disable, Condition: IS_SQLSERVER_SERVER = ""
Action: Enable, Condition: IS_SQLSERVER_SERVER <> ""

Also, to run the same scripts against multiple databases, you can specify them separated with semi-colons in the Catalog Name property as follows:


In your case, you need to create that string and set it to the MSI property associated with the Catalog Name after your end user selects target databases.

Hope this helps.

07-11-2005, 08:27 AM
Ok, I understand and have implemented the 1st part regarding the enabling/disabling. Now I would like to be able to give the user the option of selecting one or more databases. The ListBox control does not appear to support multiple selections, I don't see how to do it with the ComboBox either.

This is mandatory functionality for my setup! :(

07-21-2005, 02:21 PM
Many thanks to Stefan Krueger for posting his solution to the multiple-selection list box issue on InstallSite.org!! Using Dual ListBoxes as Replacement for a Multi-Selection List Box (http://www.installsite.org/pages/en/msi/articles/multilistbox/index.htm)

I'm happy, and most of all the boss is happy! Hidenori, the separation with ; works like a charm!