Return data from a table in Web.config

2

I develop an application, which will be implemented in several companies, and it will be necessary to make changes of connectionString in each of them (because they already have servers installed, with the database).

However, the technicians who will perform the implementation, need a way to connect to the database, without having to change the connectionString manually.

To fix this problem, I inserted a table containing the company data (name, address, etc.) and I would like to know if it is possible to put the data of connectionString into some table and return it in the value in Web.config (so the technicians will only have to fill the form with the instance, the bank, the user, etc) thus configuring the connectionString .

    
asked by anonymous 16.01.2015 / 14:20

1 answer

2

Hello,

Simply put 4 text fields for the technician to enter SERVER + BANK + USER + PASSWORD

And with the content of the textboxes fill

var section = (ConnectionStringsSection)configuration.GetSection("connectionStrings");
section.ConnectionStrings["MyConnectionString"].ConnectionString = "data source="+SERVIDOR+";initial catalog="+BANCO"+;multipleactiveresultsets=True;User ID="+USUARIO"+;Password="+SENHA+";";

And for him not to have to enter this data with each login, just save it in the app.config.

link link

A problem similar to yours here:

link

    
16.01.2015 / 16:43