How can I change the app.config file path at run time. When user select the name and enter the passward. Please can any one provide me some code for that.

Like a login form.

Recommended Answers

All 3 Replies

Are you talking about connection string?
If so you can insert values of the textBoxes into conn.string like this:

string = @"Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=" + textBoxUsername.Text + ";Password=" + textBoxPassword.Text + ";";

I want to change in app.config file path. I mean when user select the database then the changes save in app.config file. and related to that database all tables and data must be display in the project.

for ex;
I have to database
abc
xyz

if i choose abc database it has three tables then that tables and data shows i the project and viseversa.

can you tell me where i put this code. on login form. or in config file. actully I want change entire database at run time.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.