PDA

View Full Version : Change Connection String in config file



RICOUK
07-11-2008, 08:47 AM
Hi

I have looked at all the posts about this topic but none are really what I am after. I have 3 config files that all contain the connection strings (used for different programs) and I want to be able to change the string depending on the database server they select.

I have tried this (http://community.macrovision.com/archive/index.php?t-156911.html) (post 2) method but when it runs I get an error that makes it terminate the installation.

What I really want is a method to change to the correct connection string in the XML File Changes section. The methods I have tried for this only return the server name - connect to localhost, the connection string would be set to "(localhost)/sqlexpress" - where it needs to be ".\sqlexpress".

Is there a variable, that stores the actual connection string used?

Thanks,
Rich

RICOUK
07-14-2008, 11:12 AM
No one?

Thanks,
Rich

rasky74
07-14-2008, 12:18 PM
In the past I have set a property that is the connection string. I then assign that property to the Value.

RICOUK
07-15-2008, 06:39 AM
But how do you get that property to be the connection string?

Say for example, the user chooses to connect to the localhost\sqlexpress, the connection string should be .\sqlexpress but if the user wants to connect to a different server, say dbserver and the conenction string was set to be dbconnect the connection string should be set accordingly.

Presumably InstallShield knows this connection string to allow it to run SQL scripts, but how do I get this value to be used by me, doesn't matter how to write it to the config files, we are changing that, but to get the value is the important bit. There is a built in variable for the server name so there must be one for the conenction string.

Thanks,
Rich

rasky74
07-15-2008, 07:21 AM
In a Basic MSI the properties that get set are defined on the Advanced tab for that connection. Installshield probably takes those properties and creates there own connection string within their ISSQL custom actions.