rkulp
Posts: 48
Joined: Mon Feb 26, 2007 10:50 pm

SQL Server Connection String Update on Install

I want to have the user set the server, port, user id and password at installation. I have changed the connection string in the config file to:

<add name="SQLConnect.My.MySettings.HouseholdInventoryConnectionString" connectionString="Data Source=[SERVER_PROP],[PORT_PROP];Initial Catalog=HouseholdInventory;Persist Security Info=True;User ID=[USERNAME_PROP];Password=[PASSWORD_PROP];Encrypt=true;TrustServerCertificate=true" providerName="System.Data.SqlClient" />

and then uploaded it to the files and folders of the installer file. I also created a new dialog with these four parameters. The dialog seems to work fine. However, I can't get the config file to update properly. I've tried every combinatgion I can think of and the best I've gotten is to uncheck everything except the add in connection strings. On this item I have update if found but add is unchecked. If I have attributes, then they are added after the connection string and the connection string is unchanged. If I don't have attributes, then the connection string is unchanged but nothing is added.

So, all I want to do is replace the [property-PROP] with the correct value and leave everything else alone. How do I do that?
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: SQL Server Connection String Update on Install

Hello,

Please keep in mind that you shouldn't edit your XML file outside Advanced Installer so it include formatted references of your properties. If this is the case, then when importing the XML file in "Files and Folders" page the square brackets of your formatted references will be escaped by Advanced Installer and, therefore at install time the properties references won't be expanded. So, please make sure you are editing in Advanced Installer (and not outside AI) the XML file so it include formatted references of your properties.

Please take a look on our "How do I import and edit an XML file?" article steps which should be useful for you.

If this is of no avail for you, then please please send us the .AIP (project file) and a verbose log of the installation to support at advancedinstaller dot com so we can investigate them.

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

Return to “Building Installers”