Adding Connection String to
Web.config
// Adding connection
String to web.config
<connectionStrings>
<add name="con" connectionString="Data Source=DEEPAK-PC;Initial Catalog=Test;Integrated Security=True"/>
</connectionStrings>
// Using Connection on .cs page
using system.data.sqlclint;
on Button_click event
{
string s= System.Web.Configuration.WebConfigurationManager.ConnectionStrings["con"].ConnectionString;
}
<connectionStrings>
<add name="con" connectionString="Data Source=DEEPAK-PC;Initial Catalog=Test;Integrated Security=True"/>
</connectionStrings>
// Using Connection on .cs page
using system.data.sqlclint;
on Button_click event
{
string s= System.Web.Configuration.WebConfigurationManager.ConnectionStrings["con"].ConnectionString;
}
No comments:
Post a Comment