C# 클래스 CustomerService.DBUtility.SqlHelper

The SqlHelper class is intended to encapsulate high performance, scalable best practices for common uses of SqlClient.
파일 보기 프로젝트 열기: NanQi/demo

공개 프로퍼티들

프로퍼티 타입 설명
ConnectionStringInventoryDistributedTransaction string
ConnectionStringLocalTransaction string
ConnectionStringOrderDistributedTransaction string
ConnectionStringProfile string

공개 메소드들

메소드 설명
CacheParameters ( string cacheKey ) : void

add parameter array to the cache

ExecuteNonQuery ( SqlConnection connection, CommandType cmdType, string cmdText ) : int

Execute a SqlCommand (that returns no resultset) against an existing database connection using the provided parameters.

e.g.: int result = ExecuteNonQuery(connString, CommandType.StoredProcedure, "PublishOrders", new SqlParameter("@prodid", 24));

ExecuteNonQuery ( SqlTransaction trans, CommandType cmdType, string cmdText ) : int

Execute a SqlCommand (that returns no resultset) using an existing SQL Transaction using the provided parameters.

e.g.: int result = ExecuteNonQuery(connString, CommandType.StoredProcedure, "PublishOrders", new SqlParameter("@prodid", 24));

ExecuteNonQuery ( string connectionString, CommandType cmdType, string cmdText ) : int

Execute a SqlCommand (that returns no resultset) against the database specified in the connection string using the provided parameters.

e.g.: int result = ExecuteNonQuery(connString, CommandType.StoredProcedure, "PublishOrders", new SqlParameter("@prodid", 24));

ExecuteReader ( string connectionString, CommandType cmdType, string cmdText ) : System.Data.SqlClient.SqlDataReader

Execute a SqlCommand that returns a resultset against the database specified in the connection string using the provided parameters.

e.g.: SqlDataReader r = ExecuteReader(connString, CommandType.StoredProcedure, "PublishOrders", new SqlParameter("@prodid", 24));

ExecuteScalar ( SqlConnection connection, CommandType cmdType, string cmdText ) : object

Execute a SqlCommand that returns the first column of the first record against an existing database connection using the provided parameters.

e.g.: Object obj = ExecuteScalar(connString, CommandType.StoredProcedure, "PublishOrders", new SqlParameter("@prodid", 24));

ExecuteScalar ( string connectionString, CommandType cmdType, string cmdText ) : object

Execute a SqlCommand that returns the first column of the first record against the database specified in the connection string using the provided parameters.

e.g.: Object obj = ExecuteScalar(connString, CommandType.StoredProcedure, "PublishOrders", new SqlParameter("@prodid", 24));

GetCachedParameters ( string cacheKey ) : System.Data.SqlClient.SqlParameter[]

Retrieve cached parameters

비공개 메소드들

메소드 설명
PrepareCommand ( SqlCommand cmd, SqlConnection conn, SqlTransaction trans, CommandType cmdType, string cmdText, SqlParameter cmdParms ) : void

Prepare a command for execution

메소드 상세

CacheParameters() 공개 정적인 메소드

add parameter array to the cache
public static CacheParameters ( string cacheKey ) : void
cacheKey string Key to the parameter cache
리턴 void

ExecuteNonQuery() 공개 정적인 메소드

Execute a SqlCommand (that returns no resultset) against an existing database connection using the provided parameters.
e.g.: int result = ExecuteNonQuery(connString, CommandType.StoredProcedure, "PublishOrders", new SqlParameter("@prodid", 24));
public static ExecuteNonQuery ( SqlConnection connection, CommandType cmdType, string cmdText ) : int
connection System.Data.SqlClient.SqlConnection
cmdType CommandType
cmdText string
리턴 int

ExecuteNonQuery() 공개 정적인 메소드

Execute a SqlCommand (that returns no resultset) using an existing SQL Transaction using the provided parameters.
e.g.: int result = ExecuteNonQuery(connString, CommandType.StoredProcedure, "PublishOrders", new SqlParameter("@prodid", 24));
public static ExecuteNonQuery ( SqlTransaction trans, CommandType cmdType, string cmdText ) : int
trans System.Data.SqlClient.SqlTransaction an existing sql transaction
cmdType CommandType
cmdText string
리턴 int

ExecuteNonQuery() 공개 정적인 메소드

Execute a SqlCommand (that returns no resultset) against the database specified in the connection string using the provided parameters.
e.g.: int result = ExecuteNonQuery(connString, CommandType.StoredProcedure, "PublishOrders", new SqlParameter("@prodid", 24));
public static ExecuteNonQuery ( string connectionString, CommandType cmdType, string cmdText ) : int
connectionString string a valid connection string for a SqlConnection
cmdType CommandType
cmdText string
리턴 int

ExecuteReader() 공개 정적인 메소드

Execute a SqlCommand that returns a resultset against the database specified in the connection string using the provided parameters.
e.g.: SqlDataReader r = ExecuteReader(connString, CommandType.StoredProcedure, "PublishOrders", new SqlParameter("@prodid", 24));
public static ExecuteReader ( string connectionString, CommandType cmdType, string cmdText ) : System.Data.SqlClient.SqlDataReader
connectionString string a valid connection string for a SqlConnection
cmdType CommandType
cmdText string
리턴 System.Data.SqlClient.SqlDataReader

ExecuteScalar() 공개 정적인 메소드

Execute a SqlCommand that returns the first column of the first record against an existing database connection using the provided parameters.
e.g.: Object obj = ExecuteScalar(connString, CommandType.StoredProcedure, "PublishOrders", new SqlParameter("@prodid", 24));
public static ExecuteScalar ( SqlConnection connection, CommandType cmdType, string cmdText ) : object
connection System.Data.SqlClient.SqlConnection
cmdType CommandType
cmdText string
리턴 object

ExecuteScalar() 공개 정적인 메소드

Execute a SqlCommand that returns the first column of the first record against the database specified in the connection string using the provided parameters.
e.g.: Object obj = ExecuteScalar(connString, CommandType.StoredProcedure, "PublishOrders", new SqlParameter("@prodid", 24));
public static ExecuteScalar ( string connectionString, CommandType cmdType, string cmdText ) : object
connectionString string a valid connection string for a SqlConnection
cmdType CommandType
cmdText string
리턴 object

GetCachedParameters() 공개 정적인 메소드

Retrieve cached parameters
public static GetCachedParameters ( string cacheKey ) : System.Data.SqlClient.SqlParameter[]
cacheKey string key used to lookup parameters
리턴 System.Data.SqlClient.SqlParameter[]

프로퍼티 상세

ConnectionStringInventoryDistributedTransaction 공개적으로 정적으로 프로퍼티

public static string ConnectionStringInventoryDistributedTransaction
리턴 string

ConnectionStringLocalTransaction 공개적으로 정적으로 프로퍼티

public static string ConnectionStringLocalTransaction
리턴 string

ConnectionStringOrderDistributedTransaction 공개적으로 정적으로 프로퍼티

public static string ConnectionStringOrderDistributedTransaction
리턴 string

ConnectionStringProfile 공개적으로 정적으로 프로퍼티

public static string ConnectionStringProfile
리턴 string