web中在web.config配置文件中写了连接数据库的作用
第一步: 在web.config配置文件中添加有下划线的类似如下代码:
<configuration>
<connectionStrings>
<add name="SQL" connectionString="server=localhost;database=dbo.tab_ManagerInfo; userid=sa; pwd=abc123" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<compilation debug="false" targetFramework="4.0" />
</system.web>
</configuration>
第二步: 在要使用数据库连接的页面中引入