two way you can do it:
1: using Appsetting section
<appsettings><add key="APPConnectionString" value="Data Source=ABC-PC\SQLEXPRESS; Initial Catalog=TEST;Persist Security Info=true;User ID=sa; password=SA" /> </appsettings>
to access this from .CS File try this :
private string sqlConnectionString = null;
private SqlConnection sqlConn = null;
sqlConnectionString = ConfigurationManager.AppSettings["APPConnectionString"];
sqlConn = new SqlConnection(sqlConnectionString);
2: Using connection string Section:
<connectionStrings>
<add name="test" connectionString="Data Source=ABC-PC\SQLEXPRESS; Initial Catalog=TEST;Persist Security Info=true;User ID=sa; password=sa" providerName="System.Data.SqlClient"/>
</connectionStrings>
to access this from .CS File try this :
private string sqlConnectionString = null;
private SqlConnection sqlConn = null;
sqlConnectionString = ConfigurationManager.ConnectionStrings["test"].ConnectionString;
sqlConn = new SqlConnection(sqlConnectionString);