In Web.Config, you would add a key to the AppSettings Section:
<appSettings>
<add key='MyDBConnection' value='server=<ServerName>;uid=<Username>;pwd=;database=<DBName>' />
</appSettings>
Example :
<add key='ConnectionString' value= 'Server=localhost;uid=sa;pwd=;database=northwind' />
Then, in your ASP.Net application – just refer to it like this:
Dim myConnection As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings('ConnectionString'))
Share with