1. In ASP.NET, you can save database connection information in the web.config file.
Such as: Editing Web.config Files
The method of reading is as follows
Using system.configuration;
String mysqlconnectionstring = configurationSettings.appsettings ["connectionstring"];
You can read the data connection information to the string mysqlConnectionstring.
2, you can save the database connection information in a class file, use a static variable to store.
Such as:
Public Class DataAccess () {// // Todo: Add Construction Function Logic //} ///
When using, after applying the namespace, you can directly access the database connection string directly with DataAccess.connectionstring.
Such as: SqlConnnection SqlConn = New SqlConnection (dataaccess.connectionstring);