1

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>

Jeff B
  • 8,572
  • 17
  • 61
  • 140
Arif
  • 29
  • 1
  • 1
  • 8

1 Answers1

1

If I were you, I will do it this way:

Properties => Settings => Add new Settings (Make sure Scope is "user")

enter image description here

Here's how you set the value of ConnectionString:

enter image description here

User2012384
  • 4,769
  • 16
  • 70
  • 106