1. On the web. Config configuration file to set the connection string
<connectionStrings> <add name="connstring" connectionstring= " Data source=localhost;initial catalog=stud;integrated security=false;uid=sa;pwd=123456 "/> </connectionStrings>
method to get the connection string
String strconn = configurationmanager.connectionstrings["connstring"]. ToString ();
Or
<appSettings> <add key="connstring" value="Data source= Localhost;initial catalog=stud;integrated security=false;uid=sa;pwd=123456"/> </ Appsettings>
The way to connect strings
String strconn = configurationmanager.appsettings["connstring"]. ToString ();
data Source or server, Address: Database server name; Initial catalog or database: DB name integrated security default equals False, equals True when using Windows authentication, without entering the user name, password.
ADO Database Access Technology