0

according to this post, I understood how to generate connection strings and make it easier to insert server data into the app.config file.

C# Mysql connection in txt file config

however, I still face problems. After publishing the project, using the files that are generated with install the basic in the machine which I developed, in others I install but when reading the information of the database even changing in the file NameOfProgram.exe.deploy still loads the server that used for tests . How can I change the server data after publishing the project? App.config

My currently used files:

<configuration>
 <connectionStrings>
   <add name="MyDatabaseCS"   connectionString="datasource=mysqlip;port=3306;database=winprog;username=root;password=root"/>
    </connectionStrings>
</configuration>

Call string ...:

var connectionString = ConfigurationManager.ConnectionStrings["MyDatabaseCS"].ConnectionString;

How to change server, ip, port, user, password information no app.config or nameOFprogram.exe.deploy? ?

Dmitry
  • 13,797
  • 6
  • 32
  • 48
banana
  • 31
  • 2
  • 10
  • What exactly is your question? If you want to change the setting, just edit the file and change the setting – maccettura Jan 11 '18 at 21:30
  • it sounds like he wants to change the connection string at runtime. – Rafael Jan 11 '18 at 21:32
  • Yes! But it keeps connecting to the old database, not the one I need. It is as if the mysql server information used in development was still in the program. – banana Jan 11 '18 at 21:32
  • Imagine that I wanted to implement this in another makeup, which is not a developed project. In it I configure the new server, exactly the same as the one we use for development, but with different ip, different, different user. Still, trying to connect to the server. Sorry my english... – banana Jan 11 '18 at 21:34

0 Answers0