ASP.NET Web.Config连接数据库(测试)
时间:2017-03-01 12:11:11
收藏:0
阅读:330
事先说明,我是看着http://jingyan.baidu.com/article/ff411625bc461712e5823775.html做的。
web.Config代码(vs2010):
使用的是SQL server,Window身份验证,如果是Sql验证就在database=xxx后加上;uid=xxx;pwd=xxx
server=xxx填写用户Name。
另外要引用System.Configuration.dll
.cs类,需要
using System.Configuration;
using System.Data.SqlClient;
页面:
结果:
原文:http://www.cnblogs.com/Zs-20170108/p/6483326.html
评论(0)