1.<connectionstrings>
<connectionStrings>
<add name= "connectionStringName" connectionstring= "Data source= server name; Initial catalog= database name; User id= users; password= Password "
Providername= "System.Data.SqlClient"/>
</connectionStrings>
Or
<connectionStrings>
<add name= "connectionStringName" connectionstring= "sever= server name; database= database name; User id= users; password= Password "
Providername= "System.Data.SqlClient"/>
</connectionStrings>
In the <connectionStrings>, on the page can also refer to <%$ connectionstring:name%>.
2.<appsettings>
<add key= "connectionStringName" value= "data source= server name or ip;initial catalog= database name; Persist Security Info=false;user id= user; password= password; packet size=4096 ">
</add>
1) AppSettings is commonly used in 2003, and Connectionstrins is commonly used in 2005.
2) Benefits of using ConnectionString:
First: The connection string can be encrypted, using an encryption tool of Ms.
Second: The data source control can be set directly, without having to write code to read it and assign it to the control.
Third: Easy to replace the database platform, such as the Oracle database, just modify the providername.
3) write in <appsettings > to retrieve the value with system.configuration.configurationmanager.appsettings["name".
Write in <ConnectionStrings> use system.configuration.configurationmanager.connectionstrings["name"] to retrieve the value.
The difference between appsettings and connectionstrings