asp.net连接数据库web.config配置

web.config配置如下:

<connectionStrings>
    <add name="myConn" connectionString="Data Source=localhost;Initial Catalog=db_student;uid=sa;pwd=123456" providerName="System.Data.SqlClient"/>
</connectionStrings>

连接字符串:

string connectionString =
WebConfigurationManager.ConnectionStrings["myConn"].ConnectionString;

其中需要引用:

using system.web.configuration;


你可能感兴趣的:(字符串,asp.net,连接数据库)