1. Open Visual Studio
2. Create a New Website
3. Add connection string in Web.config file
<connectionStrings>
<add name="conn" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=G:\Asp.net_Controls\App_Data\Database.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
4. Use this connection string in the whole application as below.
Add namespace
using System.Web.Configuration;
And store the connection string in the string variable
static string str = WebConfigurationManager.ConnectionStrings["conn"].ConnectionString;
2. Create a New Website
3. Add connection string in Web.config file
<connectionStrings>
<add name="conn" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=G:\Asp.net_Controls\App_Data\Database.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
4. Use this connection string in the whole application as below.
Add namespace
using System.Web.Configuration;
And store the connection string in the string variable
static string str = WebConfigurationManager.ConnectionStrings["conn"].ConnectionString;
No comments:
Post a Comment
Thanks