Add connection string using appSetting in web.config

Ranjeet_8
Posted by Ranjeet_8 under ASP.NET category on | Points: 40 | Views : 1659
Add this code in web.config

<appSettings>
<add key="ConnectionStringName" value="Data Source=localhost;Initial Catalog=DataBaseName;User ID=SQLUserID;password=SQLPassword;" providerName="System.Data.SqlClient" />
</appSettings>

How to read connection string in c#

string ConStr= ConfigurationSettings.AppSettings("ConnectionStringName");

Comments or Responses

Login to post response