Reputation: 29
I have created a project which has App.config file. This App.config file is fixed. I wanna change connectionString at run time using textbox's value.
Here are two textboxes textbox1
& textbox2
. I want to input in textbox & when I click the button then does it happen?
How could I do that Exactly?
Here is the sample code of App.config file:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings>
<add name="DBconnection" connectionString="data source=ARIF\SQLEXPRESS;database=Library_Management_System; Integrated Security=SSPI;"/>
</connectionStrings>
</configuration>
Upvotes: 1
Views: 1362
Reputation: 4919
If I were you, I will do it this way:
Properties => Settings => Add new Settings (Make sure Scope is "user")
Here's how you set the value of ConnectionString:
Upvotes: 1