温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:内文广告管理系统V1.1版源码
当前文件:
TextAd/App_Code/sql.cs,打开代码结构图
TextAd/App_Code/sql.cs,打开代码结构图1using System; 2
using System.Collections.Generic; 3
using System.Text; 4
using System.Data.SqlClient; 5
using System.Data; 6
7
//该源码下载自www.51aspx.com(51aspx.com) 8
//数据库操作类 9
public class Sql 10
{ 11
private string str = null;//数据库连接字符串 12
public SqlConnection Con;//sql数据连接组件实例化 13
public SqlCommand command = new SqlCommand();//初始化一个sql命令对象 14
public Sql()//类初始化,初始化数据连接连接 15
{ 16
string path = System.Web.HttpContext.Current.Server.MapPath(System.Web.HttpContext.Current.Request.ApplicationPath); 17
// str = "Data Source=.\\SQLEXPRESS;AttachDbFilename=\"" + path + "\app_data\\ad.mdf\";Integrated Security=True;User Instance=True"; 18
str = "Data Source=(local);Initial Catalog=ad;uid=sa;pwd=sa;"; 19
20
Con = new SqlConnection(str); 21
} 22
执行sql语句的代码 47
执行存储过程的代码 81
} 82
//该源码下载自www.51aspx.com(51aspx.com)





}
}