• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 726
  • Last Modified:

Calling SQL Script and setting element content in XML files Conditionally in InstallShield 2008 Premier Edtion

We have created a installer project with SQL Express as prerequisite.We have made it optional so that user can skip it. We have included certain SQL Scripts files which automatically creates database whenever product is installed. As SQL Express is made optional, user can skip it.so, what we want is whenever user skips SQL Express installation, we do not want that SQL Script get executed.I mean we do not want to create database.So, my question is can SQL script be executed conditionally?
Another probelm we have is setting element content in XML file. we create a xml file to store connectionstring which is later used to connect to SQL server database. As SQL Server has 2 authentication modes-Windows and SQL server, connectionstring would be different for both modes.For windows mode connectionstring would be like
server=(Local)\SQLEXPRESS;Trusted_Connection=Yes;Initial Catalog=ESCtSample;
and for SQL Server mode, it would be like
server=(Local)\SQLEXPRESS;user id=sa;password=sa123;Initial Catalog=ESCtSample;
so, can we set element content conditionally in xml file?

Thanks in advance
  • 2
1 Solution

I'm not sure how you are currently making the installation of the SQL thing optional, but if you are using an interface within your install you can always do the SQL scripts based on a flag the user would set.

For example, have a checkbox one of your dialogs which the user checks to install the SQL engine.  Set a public property on that checkbox value, and then later run a custom action (managed code would be easiest if you have Installshield 2009, or else VBScript or something).  In the custom action, you can call out to your scripts and modify the XML.

Then all you would need to do is set the condition of the custom action to be if that public property from the checkbox is true.

That's just one idea of course...the great/terrible thing about Installshield is it allows for so many different solutions.  :-(

I see now that the SQL install is done with a prereq...in this case you might just have to run a custom action all the time, but inside the custom action check for the existence of a registry entry letting you know if the SQL instance exists.

The instances on the machine should be enumerated here:

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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now