Avoid writing the connection string in the code

advertisements

I already finished my first c# application which manages some tables on a sql server 2005,but I want to modify it so that it could read the connection string from a text file . By doing that I can move my application to another PC by only changing the connection string in the text file and avoid any change in the code itself. How can I do this?


Take a look at System.Configuration (http://msdn.microsoft.com/en-us/library/system.configuration.aspx). There are some built in methods for reading configuration files (App.Config)