Example Database Installation script - Advanced Installer Community
dms
Posts: 164
Joined: Tue Aug 28, 2007 7:11 am
Location: UK

Example Database Installation script

HI

As a long term user of AI I have never ceased to be amazed at the flexibility that you have built into the product but I’m sure even you would be the first to admit that it’s not always readily discoverable. To that end I was wondering if it would be possible for you to create a script that illustrates the following.

General scenario:

Install a simple winforms app that requires a backend database from which it will display information. Be able to update the database when updating the app. Must be as close to fool proof as is possible for the end user.

Specifics:

• Test for presence of a version (any version (main or express) from 2008 onwards. If present use that if not install sqlserver express 2014.
• Run a database creation script against either the database you found, or the instance of sql express that you just installed.
• Amend the app config connection string to represent the connection details that you have just used.
• Store the amended config details for use in future updates.

Specifics for updates:

• Obtain the details that you stored on first install.
• Run a query on the database to check it’s version (if it’s still version 1 and say you have a script to update to version 2 ) and update the database if necessary (this assumes a simple table in the database recording version numbers).
• Update the version number in the database.
• Make sure that the application config file gets amended as before.

I’m sure I’m not alone in wanting to know exactly how you would go about configuring AI to do this properly and correctly.

Dom
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Example Database Installation script

Hello Dom,

Thank you for your continuous interest in Advanced Installer and for your positive words. We strive to make Advanced Installer application as useful and flexible as possible based on our users needs.

In order to achieve what you want mainly you can use our "Prerequisites", "SQL Scripts" and "XML Updates" support. Also, you can take a look on our "Update SQLServer Connection String Every time User Install" thread which should be useful for you.

Also, since your installation scenario is a common one and also requested by other users I've added on our TODO list a task to create an user guide article containing a sample for this scenario. Thank you for your suggestion. We'll notify you as soon as this will be available in a future version of Advanced Installer.

Thank you for your patience and understanding.

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

Return to “Common Problems”