cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
RICOUK
Level 4

Change Connection String in config file

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 (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
Labels (1)
0 Kudos
(4) Replies
RICOUK
Level 4

No one?

Thanks,
Rich
0 Kudos
rasky74
Level 6

In the past I have set a property that is the connection string. I then assign that property to the Value.
0 Kudos
RICOUK
Level 4

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
0 Kudos
rasky74
Level 6

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.
0 Kudos