Question regarding connectionstring in app.exe.config

Got a problem you cannot solve? Try here.
orca
Posts: 7
Joined: Mon Dec 08, 2014 12:24 pm

Question regarding connectionstring in app.exe.config

Postby orca » Mon Dec 08, 2014 12:39 pm

Hi,

I'm pretty new to InstallAware and work now with X2. So far I'm very impressed and could already build up a first simple installer. However, for my application I want to set the connection string in the app.config file (which is actually an xml-file, utf-8 encoded). I try using the tool to edit xml files. The file looks sth like this:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<configuration>
   ...
   <connectionStrings>
      <add name="Hplc_resultsConnection" connectionString="server=$SERVER$;user id=$USER$;password=$PASSWORD$;persistsecurityinfo=False;database=$DATABASE$" providerName="MySql.Data.MySqlClient" />
   </connectionStrings>
</configuration>


I use the edit XML file to apply those changes. As path I entered \configuration\connectionStrings. Are the values entered in the dialog ok to achieve this?

ia_xml.PNG
ia_xml.PNG (20.36 KiB) Viewed 7025 times


Server, User, Password and Database I would read out from a dialog with corresponding textboxes. I tried to find a solution here but tere was no luck.

Ueli

jimo
Posts: 342
Joined: Fri Aug 19, 2005 10:59 am
Location: Atlanta, GA
Contact:

Re: Question regarding connectionstring in app.exe.config

Postby jimo » Mon Dec 08, 2014 4:17 pm

You have "\configuration\connectionStrings" try removing the firs backslash so it reads "configuration\connectionStrings"
Jim Oswell
Software Engineering Manager, Dental
Greenway Health, LLC
http://greenwaymedical.com

orca
Posts: 7
Joined: Mon Dec 08, 2014 12:24 pm

Re: Question regarding connectionstring in app.exe.config

Postby orca » Thu Dec 11, 2014 9:14 am

Hi,

it worked but not correct. It adds the string but not at the correct place:

Code: Select all

<connectionStrings name="Hplc_resultsConnection" connectionString="server=server;user id=user;password=pw;persistsecurityinfo=False;database=db" providerName="Mysql.Data.MySqlClient">
    <add name="Hplc_resultsConnection" connectionString="server=server_temp;user id=user_tmp;password=pw_temp;persistsecurityinfo=False;database=db_temp" providerName="MySql.Data.MySqlClient"/>
  </connectionStrings>


Correct it would be the following:

Code: Select all

<connectionStrings>
    <add name="Hplc_resultsConnection" connectionString="server=server;user id=user;password=pw;persistsecurityinfo=False;database=db" providerName="MySql.Data.MySqlClient"/>
  </connectionStrings>


It replaces the variables correctly but adds the string to the wrong place. The line already exists in the code but with default values. I'll try what happens if I add "add" at the end of the path.

That did it. I was one level above when finishing the nodes with connectionStrings.

I set the option to backup the file. Is it a bug if the setup creates a second backup file when uninstalling?

Ueli

shlomid
Posts: 7
Joined: Sun Apr 03, 2011 12:19 am

Re: Question regarding connectionstring in app.exe.config

Postby shlomid » Mon Nov 16, 2015 4:56 am

You guys are great. i was using the Replace string and write to file method in order to edit XML but this post finally help me work with the "Edit XML File" commad. thanks!
BTW, i`m using IA x3


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 136 guests