C# Class CustomerService.DBUtility.DbHelperSQL

数据访问抽象基础类 Copyright (C) FengZhan
显示文件 Open project: NanQi/demo

Public Properties

Property Type Description
connectionString string

Public Methods

Method Description
ColumnExists ( string tableName, string columnName ) : bool

判断是否存在某表的某个字段

DbHelperSQL ( ) : System
ExecuteReader ( string strSQL ) : System.Data.SqlClient.SqlDataReader

执行查询语句,返回SqlDataReader ( 注意:调用该方法后,一定要对SqlDataReader进行Close )

ExecuteSql ( string SQLString ) : int

执行SQL语句,返回影响的记录数

ExecuteSql ( string SQLString, string content ) : int

执行带一个存储过程参数的的SQL语句。

ExecuteSqlByTime ( string SQLString, int Times ) : int
ExecuteSqlGet ( string SQLString, string content ) : object

执行带一个存储过程参数的的SQL语句。

ExecuteSqlInsertImg ( string strSQL, byte fs ) : int

向数据库里插入图像格式的字段(和上面情况类似的另一种实例)

ExecuteSqlTran ( List SQLStringList ) : int

执行多条SQL语句,实现数据库事务。

ExecuteSqlTran ( System cmdList ) : int

执行多条SQL语句,实现数据库事务。

ExecuteSqlTran ( Hashtable SQLStringList ) : void

执行多条SQL语句,实现数据库事务。

ExecuteSqlTranWithIndentity ( Hashtable SQLStringList ) : void

执行多条SQL语句,实现数据库事务。

ExecuteSqlTranWithIndentity ( System SQLStringList ) : void

执行多条SQL语句,实现数据库事务。

Exists ( string strSql ) : bool
GetMaxID ( string FieldName, string TableName ) : int
GetSingle ( string SQLString ) : object

执行一条计算查询结果语句,返回查询结果(object)。

GetSingle ( string SQLString, int Times ) : object
Query ( string SQLString ) : DataSet

执行查询语句,返回DataSet

Query ( string SQLString, int Times ) : DataSet
RunProcedure ( string storedProcName, IDataParameter parameters, string tableName ) : DataSet

执行存储过程

RunProcedure ( string storedProcName, IDataParameter parameters, string tableName, int Times ) : DataSet
RunProcedure ( string storedProcName, IDataParameter parameters ) : System.Data.SqlClient.SqlDataReader

执行存储过程,返回SqlDataReader ( 注意:调用该方法后,一定要对SqlDataReader进行Close )

RunProcedure ( string storedProcName, IDataParameter parameters, int &rowsAffected ) : int

执行存储过程,返回影响的行数

TabExists ( string TableName ) : bool

表是否存在

Private Methods

Method Description
BuildIntCommand ( SqlConnection connection, string storedProcName, IDataParameter parameters ) : SqlCommand

创建 SqlCommand 对象实例(用来返回一个整数值)

BuildQueryCommand ( SqlConnection connection, string storedProcName, IDataParameter parameters ) : SqlCommand

构建 SqlCommand 对象(用来返回一个结果集,而不是一个整数值)

PrepareCommand ( SqlCommand cmd, SqlConnection conn, SqlTransaction trans, string cmdText, SqlParameter cmdParms ) : void

Method Details

ColumnExists() public static method

判断是否存在某表的某个字段
public static ColumnExists ( string tableName, string columnName ) : bool
tableName string 表名称
columnName string 列名称
return bool

DbHelperSQL() public method

public DbHelperSQL ( ) : System
return System

ExecuteReader() public static method

执行查询语句,返回SqlDataReader ( 注意:调用该方法后,一定要对SqlDataReader进行Close )
public static ExecuteReader ( string strSQL ) : System.Data.SqlClient.SqlDataReader
strSQL string 查询语句
return System.Data.SqlClient.SqlDataReader

ExecuteSql() public static method

执行SQL语句,返回影响的记录数
public static ExecuteSql ( string SQLString ) : int
SQLString string SQL语句
return int

ExecuteSql() public static method

执行带一个存储过程参数的的SQL语句。
public static ExecuteSql ( string SQLString, string content ) : int
SQLString string SQL语句
content string 参数内容,比如一个字段是格式复杂的文章,有特殊符号,可以通过这个方式添加
return int

ExecuteSqlByTime() public static method

public static ExecuteSqlByTime ( string SQLString, int Times ) : int
SQLString string
Times int
return int

ExecuteSqlGet() public static method

执行带一个存储过程参数的的SQL语句。
public static ExecuteSqlGet ( string SQLString, string content ) : object
SQLString string SQL语句
content string 参数内容,比如一个字段是格式复杂的文章,有特殊符号,可以通过这个方式添加
return object

ExecuteSqlInsertImg() public static method

向数据库里插入图像格式的字段(和上面情况类似的另一种实例)
public static ExecuteSqlInsertImg ( string strSQL, byte fs ) : int
strSQL string SQL语句
fs byte 图像字节,数据库的字段类型为image的情况
return int

ExecuteSqlTran() public static method

执行多条SQL语句,实现数据库事务。
public static ExecuteSqlTran ( List SQLStringList ) : int
SQLStringList List 多条SQL语句
return int

ExecuteSqlTran() public static method

执行多条SQL语句,实现数据库事务。
public static ExecuteSqlTran ( System cmdList ) : int
cmdList System
return int

ExecuteSqlTran() public static method

执行多条SQL语句,实现数据库事务。
public static ExecuteSqlTran ( Hashtable SQLStringList ) : void
SQLStringList System.Collections.Hashtable SQL语句的哈希表(key为sql语句,value是该语句的SqlParameter[])
return void

ExecuteSqlTranWithIndentity() public static method

执行多条SQL语句,实现数据库事务。
public static ExecuteSqlTranWithIndentity ( Hashtable SQLStringList ) : void
SQLStringList System.Collections.Hashtable SQL语句的哈希表(key为sql语句,value是该语句的SqlParameter[])
return void

ExecuteSqlTranWithIndentity() public static method

执行多条SQL语句,实现数据库事务。
public static ExecuteSqlTranWithIndentity ( System SQLStringList ) : void
SQLStringList System SQL语句的哈希表(key为sql语句,value是该语句的SqlParameter[])
return void

Exists() public static method

public static Exists ( string strSql ) : bool
strSql string
return bool

GetMaxID() public static method

public static GetMaxID ( string FieldName, string TableName ) : int
FieldName string
TableName string
return int

GetSingle() public static method

执行一条计算查询结果语句,返回查询结果(object)。
public static GetSingle ( string SQLString ) : object
SQLString string 计算查询结果语句
return object

GetSingle() public static method

public static GetSingle ( string SQLString, int Times ) : object
SQLString string
Times int
return object

Query() public static method

执行查询语句,返回DataSet
public static Query ( string SQLString ) : DataSet
SQLString string 查询语句
return System.Data.DataSet

Query() public static method

public static Query ( string SQLString, int Times ) : DataSet
SQLString string
Times int
return System.Data.DataSet

RunProcedure() public static method

执行存储过程
public static RunProcedure ( string storedProcName, IDataParameter parameters, string tableName ) : DataSet
storedProcName string 存储过程名
parameters IDataParameter 存储过程参数
tableName string DataSet结果中的表名
return System.Data.DataSet

RunProcedure() public static method

public static RunProcedure ( string storedProcName, IDataParameter parameters, string tableName, int Times ) : DataSet
storedProcName string
parameters IDataParameter
tableName string
Times int
return System.Data.DataSet

RunProcedure() public static method

执行存储过程,返回SqlDataReader ( 注意:调用该方法后,一定要对SqlDataReader进行Close )
public static RunProcedure ( string storedProcName, IDataParameter parameters ) : System.Data.SqlClient.SqlDataReader
storedProcName string 存储过程名
parameters IDataParameter 存储过程参数
return System.Data.SqlClient.SqlDataReader

RunProcedure() public static method

执行存储过程,返回影响的行数
public static RunProcedure ( string storedProcName, IDataParameter parameters, int &rowsAffected ) : int
storedProcName string 存储过程名
parameters IDataParameter 存储过程参数
rowsAffected int 影响的行数
return int

TabExists() public static method

表是否存在
public static TabExists ( string TableName ) : bool
TableName string
return bool

Property Details

connectionString public_oe static_oe property

public static string connectionString
return string