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

Posted on 2009-04-17
Last Modified: 2013-11-14
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, 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
Question by:MarkClabaugh
    LVL 12

    Expert Comment


    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.  :-(
    LVL 12

    Accepted Solution


    I see now that the SQL install is done with a 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

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Installations often have prerequisites, such as “Microsoft .Net framework is required for this product”. The usual implementation in MSI installations is system search for a particular registry setting representing the required prerequisite, followe…
    In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now