C# Class DAL.SqlHelper

The SqlHelper class is intended to encapsulate high performance, scalable best practices for common uses of SqlClient
显示文件 Open project: NanQi/demo Class Usage Examples

Public Methods

Method Description
CloseConnection ( ) : void

关闭连接

ExecuteDataTable ( string procName, string tblName ) : DataTable

返回DataTable

ExecuteNonQuery ( string commandText ) : int

执行ExecuteNonQuery

ExecuteReader ( string commandText ) : System.Data.SqlClient.SqlDataReader

执行ExecuteReader

ExecuteScalar ( string commandText ) : object

执行ExecuteScalar

SqlHelper ( ) : System

构造函数

Private Methods

Method Description
ForeachParames ( SqlCommand cmd, SqlParameter parames ) : SqlCommand

给Command对象填充参数

OpenConnection ( ) : SqlConnection

打开连接

Method Details

CloseConnection() public method

关闭连接
public CloseConnection ( ) : void
return void

ExecuteDataTable() public method

返回DataTable
public ExecuteDataTable ( string procName, string tblName ) : DataTable
procName string 存储过程名
tblName string 表名
return System.Data.DataTable

ExecuteNonQuery() public method

执行ExecuteNonQuery
public ExecuteNonQuery ( string commandText ) : int
commandText string 存储过程名
return int

ExecuteReader() public method

执行ExecuteReader
public ExecuteReader ( string commandText ) : System.Data.SqlClient.SqlDataReader
commandText string 存储过程名
return System.Data.SqlClient.SqlDataReader

ExecuteScalar() public method

执行ExecuteScalar
public ExecuteScalar ( string commandText ) : object
commandText string 存储过程名
return object

SqlHelper() public method

构造函数
public SqlHelper ( ) : System
return System