asp.net 连接SQL数据库的封装类,及其调用方法

[复制链接]
查看11 | 回复4 | 2013-7-13 17:58:46 | 显示全部楼层 |阅读模式
1.web.config 中调用的时候 string strConn = System.Configuration.ConfigurationManager.AppSettings["ConnectionString"].ToString(); SqlConnection Conn = new SqlConnection(strConn); 2.或者不用web.config直接在文件中写 SqlConnection conn = new SqlCo...
回复

使用道具 举报

千问 | 2013-7-13 17:58:46 | 显示全部楼层
db.cs
public static SqlConnection createconnection()
{
SqlConnection con = new SqlConnection("Server=.;Database=nowshop;uid=sa;pwd=;");
return con; ...
回复

使用道具 举报

千问 | 2013-7-13 17:58:46 | 显示全部楼层
在WebConfig里配置Web.config 类里调用string conns = Con...
回复

使用道具 举报

千问 | 2013-7-13 17:58:46 | 显示全部楼层
用 Web.config ...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行