Question: > 
> **Possible Duplicate:**  
> 
> [VS2005 C# Programmatically change connection string contained in app.config](https://stackoverflow.com/questions/63546/vs2005-c-sharp-programmatically-change-connection-string-contained-in-app-config) 
> 
> 
> 

I have created a WinForms project in my PC using C#, and would like to deploy the project to other pc's, but I need to change the connection string in the app.config in order to connect the sql sever database in other pc's, and I want the users to configure the connection string. 

How can I accomplish this?

Answer: 
If you've created a settings file for your project, there will be a class that represents the properties in a type-safe manner. This is typically something like `TiddleBits.Properties.Settings.Default`, where *TwiddleBits* is your assembly name.

If you haven't created a settings file for your project, do it. It vastly simplifies working with configuration files.

Once the class exists, you can read and write properties just like any other class. Just remember to save your changes once you've finished assigning properties, or they'll be discarded.
Modify the app config from code.
<http://chiragrdarji.wordpress.com/2008/09/25/how-to-change-appconfig-file-run-time-using-c/>