First, set the connection string in
App.Config
File.
<configuration>
<connectionstrings>
<add name="CharityManagement">
connectionString="Data Source=.;Initial Catalog=CharityManagement;Integrated Security=True"/>
</add></connectionstrings>
</configuration>
In your forms; set references that you want to use.
using System.Data.SqlClient;
Then you can get Connection String from App.Config by use ConnectionStrings properties.
var connectionString=ConfigurationManager.ConnectionStrings["CharityManagement"].ConnectionString;
Refer:
http://msdn.microsoft.com/en-us/library/ms178411.aspx[
^]