I want to change the dataset table adapter connection string at run time. Now i have a code to change that connection string but it change the server name only not changing database name, username and passowrd. Please help me to fix this error..
This is my partial code :
Properties.Settings.Default["testConnectionString"] = String.Format("server={0};Port={1}; database={2};User Id={3};password={4}", "172.23.2.32", "3306", "hrm", "root", "test123");
The above code only change the ip address and data inserted into database.But now am change the database name means data inserted into “hrm” database. Please help me to fix this …
I conducted an experiment with properties and was able to get User settings to change just fine.
Settings File
Notice that the difference between these two values is in the Scope. User settings can change at runtime. Application settings cannot change at runtime.
Code
Output
Source
How To: Write User Settings at Run Time with C#