C# Class yycms.service.SqlHelper

The SqlHelper class is intended to encapsulate high performance, scalable best practices for common uses of SqlClient
Datei anzeigen Open project: seven1276/yycms

Public Methods

Method Description
CreateCommand ( SqlConnection connection, string spName ) : SqlCommand

Simplify the creation of a Sql command object by allowing a stored procedure and optional parameters to be provided

e.g.: SqlCommand command = CreateCommand(conn, "AddCustomer", "CustomerID", "CustomerName");

ExecuteDataset ( SqlConnection connection, CommandType commandType, string commandText ) : DataSet

Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlConnection.

e.g.: DataSet ds = ExecuteDataset(conn, CommandType.StoredProcedure, "GetOrders");

ExecuteDataset ( SqlConnection connection, string spName ) : DataSet

Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlConnection using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: DataSet ds = ExecuteDataset(conn, "GetOrders", 24, 36);

ExecuteDataset ( SqlTransaction transaction, CommandType commandType, string commandText ) : DataSet

Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlTransaction.

e.g.: DataSet ds = ExecuteDataset(trans, CommandType.StoredProcedure, "GetOrders");

ExecuteDataset ( SqlTransaction transaction, string spName ) : DataSet

Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlTransaction using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: DataSet ds = ExecuteDataset(trans, "GetOrders", 24, 36);

ExecuteDataset ( string connectionString, CommandType commandType, string commandText ) : DataSet

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

e.g.: DataSet ds = ExecuteDataset(connString, CommandType.StoredProcedure, "GetOrders");

ExecuteDataset ( string connectionString, string spName ) : DataSet

Execute a stored procedure via a SqlCommand (that returns a resultset) against the database specified in the connection string using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: DataSet ds = ExecuteDataset(connString, "GetOrders", 24, 36);

ExecuteDatasetTypedParams ( SqlConnection connection, String spName, DataRow dataRow ) : DataSet

Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlConnection using the dataRow column values as the store procedure's parameters values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on row values.

ExecuteDatasetTypedParams ( SqlTransaction transaction, String spName, DataRow dataRow ) : DataSet

Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlTransaction using the dataRow column values as the stored procedure's parameters values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on row values.

ExecuteDatasetTypedParams ( string connectionString, String spName, DataRow dataRow ) : DataSet

Execute a stored procedure via a SqlCommand (that returns a resultset) against the database specified in the connection string using the dataRow column values as the stored procedure's parameters values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on row values.

ExecuteNonQuery ( SqlConnection connection, CommandType commandType, string commandText ) : int

Execute a SqlCommand (that returns no resultset and takes no parameters) against the provided SqlConnection.

e.g.: int result = ExecuteNonQuery(conn, CommandType.StoredProcedure, "PublishOrders");

ExecuteNonQuery ( SqlConnection connection, string spName ) : int

Execute a stored procedure via a SqlCommand (that returns no resultset) against the specified SqlConnection using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: int result = ExecuteNonQuery(conn, "PublishOrders", 24, 36);

ExecuteNonQuery ( SqlTransaction transaction, CommandType commandType, string commandText ) : int

Execute a SqlCommand (that returns no resultset and takes no parameters) against the provided SqlTransaction.

e.g.: int result = ExecuteNonQuery(trans, CommandType.StoredProcedure, "PublishOrders");

ExecuteNonQuery ( SqlTransaction transaction, string spName ) : int

Execute a stored procedure via a SqlCommand (that returns no resultset) against the specified SqlTransaction using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: int result = ExecuteNonQuery(conn, trans, "PublishOrders", 24, 36);

ExecuteNonQuery ( string connectionString, CommandType commandType, string commandText ) : int

Execute a SqlCommand (that returns no resultset and takes no parameters) against the database specified in the connection string

e.g.: int result = ExecuteNonQuery(connString, CommandType.StoredProcedure, "PublishOrders");

ExecuteNonQuery ( string connectionString, string spName ) : int

Execute a stored procedure via a SqlCommand (that returns no resultset) against the database specified in the connection string using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: int result = ExecuteNonQuery(connString, "PublishOrders", 24, 36);

ExecuteNonQueryTypedParams ( SqlConnection connection, String spName, DataRow dataRow ) : int

Execute a stored procedure via a SqlCommand (that returns no resultset) against the specified SqlConnection using the dataRow column values as the stored procedure's parameters values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on row values.

ExecuteNonQueryTypedParams ( SqlTransaction transaction, String spName, DataRow dataRow ) : int

Execute a stored procedure via a SqlCommand (that returns no resultset) against the specified SqlTransaction using the dataRow column values as the stored procedure's parameters values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on row values.

ExecuteNonQueryTypedParams ( String connectionString, String spName, DataRow dataRow ) : int

Execute a stored procedure via a SqlCommand (that returns no resultset) against the database specified in the connection string using the dataRow column values as the stored procedure's parameters values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on row values.

ExecuteReader ( SqlConnection connection, CommandType commandType, string commandText ) : System.Data.SqlClient.SqlDataReader

Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlConnection.

e.g.: SqlDataReader dr = ExecuteReader(conn, CommandType.StoredProcedure, "GetOrders");

ExecuteReader ( SqlConnection connection, string spName ) : System.Data.SqlClient.SqlDataReader

Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlConnection using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: SqlDataReader dr = ExecuteReader(conn, "GetOrders", 24, 36);

ExecuteReader ( SqlTransaction transaction, CommandType commandType, string commandText ) : System.Data.SqlClient.SqlDataReader

Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlTransaction.

e.g.: SqlDataReader dr = ExecuteReader(trans, CommandType.StoredProcedure, "GetOrders");

ExecuteReader ( SqlTransaction transaction, string spName ) : System.Data.SqlClient.SqlDataReader

Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlTransaction using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: SqlDataReader dr = ExecuteReader(trans, "GetOrders", 24, 36);

ExecuteReader ( string connectionString, CommandType commandType, string commandText ) : System.Data.SqlClient.SqlDataReader

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

e.g.: SqlDataReader dr = ExecuteReader(connString, CommandType.StoredProcedure, "GetOrders");

ExecuteReader ( string connectionString, string spName ) : System.Data.SqlClient.SqlDataReader

Execute a stored procedure via a SqlCommand (that returns a resultset) against the database specified in the connection string using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: SqlDataReader dr = ExecuteReader(connString, "GetOrders", 24, 36);

ExecuteReaderTypedParams ( SqlConnection connection, String spName, DataRow dataRow ) : System.Data.SqlClient.SqlDataReader

Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlConnection using the dataRow column values as the stored procedure's parameters values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

ExecuteReaderTypedParams ( SqlTransaction transaction, String spName, DataRow dataRow ) : System.Data.SqlClient.SqlDataReader

Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlTransaction using the dataRow column values as the stored procedure's parameters values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

ExecuteReaderTypedParams ( String connectionString, String spName, DataRow dataRow ) : System.Data.SqlClient.SqlDataReader

Execute a stored procedure via a SqlCommand (that returns a resultset) against the database specified in the connection string using the dataRow column values as the stored procedure's parameters values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

ExecuteScalar ( SqlConnection connection, CommandType commandType, string commandText ) : object

Execute a SqlCommand (that returns a 1x1 resultset and takes no parameters) against the provided SqlConnection.

e.g.: int orderCount = (int)ExecuteScalar(conn, CommandType.StoredProcedure, "GetOrderCount");

ExecuteScalar ( SqlConnection connection, string spName ) : object

Execute a stored procedure via a SqlCommand (that returns a 1x1 resultset) against the specified SqlConnection using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: int orderCount = (int)ExecuteScalar(conn, "GetOrderCount", 24, 36);

ExecuteScalar ( SqlTransaction transaction, CommandType commandType, string commandText ) : object

Execute a SqlCommand (that returns a 1x1 resultset and takes no parameters) against the provided SqlTransaction.

e.g.: int orderCount = (int)ExecuteScalar(trans, CommandType.StoredProcedure, "GetOrderCount");

ExecuteScalar ( SqlTransaction transaction, string spName ) : object

Execute a stored procedure via a SqlCommand (that returns a 1x1 resultset) against the specified SqlTransaction using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: int orderCount = (int)ExecuteScalar(trans, "GetOrderCount", 24, 36);

ExecuteScalar ( string connectionString, CommandType commandType, string commandText ) : object

Execute a SqlCommand (that returns a 1x1 resultset and takes no parameters) against the database specified in the connection string.

e.g.: int orderCount = (int)ExecuteScalar(connString, CommandType.StoredProcedure, "GetOrderCount");

ExecuteScalar ( string connectionString, string spName ) : object

Execute a stored procedure via a SqlCommand (that returns a 1x1 resultset) against the database specified in the connection string using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: int orderCount = (int)ExecuteScalar(connString, "GetOrderCount", 24, 36);

ExecuteScalarTypedParams ( SqlConnection connection, String spName, DataRow dataRow ) : object

Execute a stored procedure via a SqlCommand (that returns a 1x1 resultset) against the specified SqlConnection using the dataRow column values as the stored procedure's parameters values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

ExecuteScalarTypedParams ( SqlTransaction transaction, String spName, DataRow dataRow ) : object

Execute a stored procedure via a SqlCommand (that returns a 1x1 resultset) against the specified SqlTransaction using the dataRow column values as the stored procedure's parameters values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

ExecuteScalarTypedParams ( String connectionString, String spName, DataRow dataRow ) : object

Execute a stored procedure via a SqlCommand (that returns a 1x1 resultset) against the database specified in the connection string using the dataRow column values as the stored procedure's parameters values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

ExecuteXmlReader ( SqlConnection connection, CommandType commandType, string commandText ) : XmlReader

Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlConnection.

e.g.: XmlReader r = ExecuteXmlReader(conn, CommandType.StoredProcedure, "GetOrders");

ExecuteXmlReader ( SqlConnection connection, string spName ) : XmlReader

Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlConnection using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: XmlReader r = ExecuteXmlReader(conn, "GetOrders", 24, 36);

ExecuteXmlReader ( SqlTransaction transaction, CommandType commandType, string commandText ) : XmlReader

Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlTransaction.

e.g.: XmlReader r = ExecuteXmlReader(trans, CommandType.StoredProcedure, "GetOrders");

ExecuteXmlReader ( SqlTransaction transaction, string spName ) : XmlReader

Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlTransaction using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: XmlReader r = ExecuteXmlReader(trans, "GetOrders", 24, 36);

ExecuteXmlReaderTypedParams ( SqlConnection connection, String spName, DataRow dataRow ) : XmlReader

Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlConnection using the dataRow column values as the stored procedure's parameters values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

ExecuteXmlReaderTypedParams ( SqlTransaction transaction, String spName, DataRow dataRow ) : XmlReader

Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlTransaction using the dataRow column values as the stored procedure's parameters values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

FillDataset ( SqlConnection connection, CommandType commandType, string commandText, DataSet dataSet, string tableNames ) : void

Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlConnection.

e.g.: FillDataset(conn, CommandType.StoredProcedure, "GetOrders", ds, new string[] {"orders"});

FillDataset ( SqlConnection connection, string spName, DataSet dataSet, string tableNames ) : void

Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlConnection using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: FillDataset(conn, "GetOrders", ds, new string[] {"orders"}, 24, 36);

FillDataset ( SqlTransaction transaction, CommandType commandType, string commandText, DataSet dataSet, string tableNames ) : void

Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlTransaction.

e.g.: FillDataset(trans, CommandType.StoredProcedure, "GetOrders", ds, new string[] {"orders"});

FillDataset ( SqlTransaction transaction, string spName, DataSet dataSet, string tableNames ) : void

Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlTransaction using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: FillDataset(trans, "GetOrders", ds, new string[]{"orders"}, 24, 36);

FillDataset ( string connectionString, CommandType commandType, string commandText, DataSet dataSet, string tableNames ) : void

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

e.g.: FillDataset(connString, CommandType.StoredProcedure, "GetOrders", ds, new string[] {"orders"});

FillDataset ( string connectionString, string spName, DataSet dataSet, string tableNames ) : void

Execute a stored procedure via a SqlCommand (that returns a resultset) against the database specified in the connection string using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: FillDataset(connString, CommandType.StoredProcedure, "GetOrders", ds, new string[] {"orders"}, 24);

TableValuedToDB ( string _sqlConnStr, DataTable dt ) : void

批量插入

UpdateDataset ( SqlCommand insertCommand, SqlCommand deleteCommand, SqlCommand updateCommand, DataSet dataSet, string tableName ) : void

Executes the respective command for each inserted, updated, or deleted row in the DataSet.

e.g.: UpdateDataset(conn, insertCommand, deleteCommand, updateCommand, dataSet, "Order");

Private Methods

Method Description
AssignParameterValues ( SqlParameter commandParameters, DataRow dataRow ) : void

This method assigns dataRow column values to an array of SqlParameters

AssignParameterValues ( SqlParameter commandParameters, object parameterValues ) : void

This method assigns an array of values to an array of SqlParameters

AttachParameters ( SqlCommand command, SqlParameter commandParameters ) : void

This method is used to attach array of SqlParameters to a SqlCommand. This method will assign a value of DbNull to any parameter with a direction of InputOutput and a value of null. This behavior will prevent default values from being used, but this will be the less common case than an intended pure output parameter (derived as InputOutput) where the user provided no input value.

ExecuteReader ( SqlConnection connection, SqlTransaction transaction, CommandType commandType, string commandText, SqlParameter commandParameters, SqlConnectionOwnership connectionOwnership ) : System.Data.SqlClient.SqlDataReader

Create and prepare a SqlCommand, and call ExecuteReader with the appropriate CommandBehavior.

If we created and opened the connection, we want the connection to be closed when the DataReader is closed. If the caller provided the connection, we want to leave it to them to manage.

FillDataset ( SqlConnection connection, SqlTransaction transaction, CommandType commandType, string commandText, DataSet dataSet, string tableNames ) : void

Private helper method that execute a SqlCommand (that returns a resultset) against the specified SqlTransaction and SqlConnection using the provided parameters.

e.g.: FillDataset(conn, trans, CommandType.StoredProcedure, "GetOrders", ds, new string[] {"orders"}, new SqlParameter("@prodid", 24));

PrepareCommand ( SqlCommand command, SqlConnection connection, SqlTransaction transaction, CommandType commandType, string commandText, SqlParameter commandParameters, bool &mustCloseConnection ) : void

This method opens (if necessary) and assigns a connection, transaction, command type and parameters to the provided command

SqlHelper ( ) : System

Method Details

CreateCommand() public static method

Simplify the creation of a Sql command object by allowing a stored procedure and optional parameters to be provided
e.g.: SqlCommand command = CreateCommand(conn, "AddCustomer", "CustomerID", "CustomerName");
public static CreateCommand ( SqlConnection connection, string spName ) : SqlCommand
connection System.Data.SqlClient.SqlConnection A valid SqlConnection object
spName string The name of the stored procedure
return System.Data.SqlClient.SqlCommand

ExecuteDataset() public static method

Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlConnection.
e.g.: DataSet ds = ExecuteDataset(conn, CommandType.StoredProcedure, "GetOrders");
public static ExecuteDataset ( SqlConnection connection, CommandType commandType, string commandText ) : DataSet
connection System.Data.SqlClient.SqlConnection A valid SqlConnection
commandType CommandType The CommandType (stored procedure, text, etc.)
commandText string The stored procedure name or T-SQL command
return System.Data.DataSet

ExecuteDataset() public static method

Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlConnection using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: DataSet ds = ExecuteDataset(conn, "GetOrders", 24, 36);
public static ExecuteDataset ( SqlConnection connection, string spName ) : DataSet
connection System.Data.SqlClient.SqlConnection A valid SqlConnection
spName string The name of the stored procedure
return System.Data.DataSet

ExecuteDataset() public static method

Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlTransaction.
e.g.: DataSet ds = ExecuteDataset(trans, CommandType.StoredProcedure, "GetOrders");
public static ExecuteDataset ( SqlTransaction transaction, CommandType commandType, string commandText ) : DataSet
transaction System.Data.SqlClient.SqlTransaction A valid SqlTransaction
commandType CommandType The CommandType (stored procedure, text, etc.)
commandText string The stored procedure name or T-SQL command
return System.Data.DataSet

ExecuteDataset() public static method

Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlTransaction using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: DataSet ds = ExecuteDataset(trans, "GetOrders", 24, 36);
public static ExecuteDataset ( SqlTransaction transaction, string spName ) : DataSet
transaction System.Data.SqlClient.SqlTransaction A valid SqlTransaction
spName string The name of the stored procedure
return System.Data.DataSet

ExecuteDataset() public static method

Execute a SqlCommand (that returns a resultset and takes no parameters) against the database specified in the connection string.
e.g.: DataSet ds = ExecuteDataset(connString, CommandType.StoredProcedure, "GetOrders");
public static ExecuteDataset ( string connectionString, CommandType commandType, string commandText ) : DataSet
connectionString string A valid connection string for a SqlConnection
commandType CommandType The CommandType (stored procedure, text, etc.)
commandText string The stored procedure name or T-SQL command
return System.Data.DataSet

ExecuteDataset() public static method

Execute a stored procedure via a SqlCommand (that returns a resultset) against the database specified in the connection string using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: DataSet ds = ExecuteDataset(connString, "GetOrders", 24, 36);
public static ExecuteDataset ( string connectionString, string spName ) : DataSet
connectionString string A valid connection string for a SqlConnection
spName string The name of the stored procedure
return System.Data.DataSet

ExecuteDatasetTypedParams() public static method

Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlConnection using the dataRow column values as the store procedure's parameters values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on row values.
public static ExecuteDatasetTypedParams ( SqlConnection connection, String spName, DataRow dataRow ) : DataSet
connection System.Data.SqlClient.SqlConnection A valid SqlConnection object
spName String The name of the stored procedure
dataRow System.Data.DataRow The dataRow used to hold the stored procedure's parameter values.
return System.Data.DataSet

ExecuteDatasetTypedParams() public static method

Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlTransaction using the dataRow column values as the stored procedure's parameters values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on row values.
public static ExecuteDatasetTypedParams ( SqlTransaction transaction, String spName, DataRow dataRow ) : DataSet
transaction System.Data.SqlClient.SqlTransaction A valid SqlTransaction object
spName String The name of the stored procedure
dataRow System.Data.DataRow The dataRow used to hold the stored procedure's parameter values.
return System.Data.DataSet

ExecuteDatasetTypedParams() public static method

Execute a stored procedure via a SqlCommand (that returns a resultset) against the database specified in the connection string using the dataRow column values as the stored procedure's parameters values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on row values.
public static ExecuteDatasetTypedParams ( string connectionString, String spName, DataRow dataRow ) : DataSet
connectionString string A valid connection string for a SqlConnection
spName String The name of the stored procedure
dataRow System.Data.DataRow The dataRow used to hold the stored procedure's parameter values.
return System.Data.DataSet

ExecuteNonQuery() public static method

Execute a SqlCommand (that returns no resultset and takes no parameters) against the provided SqlConnection.
e.g.: int result = ExecuteNonQuery(conn, CommandType.StoredProcedure, "PublishOrders");
public static ExecuteNonQuery ( SqlConnection connection, CommandType commandType, string commandText ) : int
connection System.Data.SqlClient.SqlConnection A valid SqlConnection
commandType CommandType The CommandType (stored procedure, text, etc.)
commandText string The stored procedure name or T-SQL command
return int

ExecuteNonQuery() public static method

Execute a stored procedure via a SqlCommand (that returns no resultset) against the specified SqlConnection using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: int result = ExecuteNonQuery(conn, "PublishOrders", 24, 36);
public static ExecuteNonQuery ( SqlConnection connection, string spName ) : int
connection System.Data.SqlClient.SqlConnection A valid SqlConnection
spName string The name of the stored procedure
return int

ExecuteNonQuery() public static method

Execute a SqlCommand (that returns no resultset and takes no parameters) against the provided SqlTransaction.
e.g.: int result = ExecuteNonQuery(trans, CommandType.StoredProcedure, "PublishOrders");
public static ExecuteNonQuery ( SqlTransaction transaction, CommandType commandType, string commandText ) : int
transaction System.Data.SqlClient.SqlTransaction A valid SqlTransaction
commandType CommandType The CommandType (stored procedure, text, etc.)
commandText string The stored procedure name or T-SQL command
return int

ExecuteNonQuery() public static method

Execute a stored procedure via a SqlCommand (that returns no resultset) against the specified SqlTransaction using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: int result = ExecuteNonQuery(conn, trans, "PublishOrders", 24, 36);
public static ExecuteNonQuery ( SqlTransaction transaction, string spName ) : int
transaction System.Data.SqlClient.SqlTransaction A valid SqlTransaction
spName string The name of the stored procedure
return int

ExecuteNonQuery() public static method

Execute a SqlCommand (that returns no resultset and takes no parameters) against the database specified in the connection string
e.g.: int result = ExecuteNonQuery(connString, CommandType.StoredProcedure, "PublishOrders");
public static ExecuteNonQuery ( string connectionString, CommandType commandType, string commandText ) : int
connectionString string A valid connection string for a SqlConnection
commandType CommandType The CommandType (stored procedure, text, etc.)
commandText string The stored procedure name or T-SQL command
return int

ExecuteNonQuery() public static method

Execute a stored procedure via a SqlCommand (that returns no resultset) against the database specified in the connection string using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: int result = ExecuteNonQuery(connString, "PublishOrders", 24, 36);
public static ExecuteNonQuery ( string connectionString, string spName ) : int
connectionString string A valid connection string for a SqlConnection
spName string The name of the stored prcedure
return int

ExecuteNonQueryTypedParams() public static method

Execute a stored procedure via a SqlCommand (that returns no resultset) against the specified SqlConnection using the dataRow column values as the stored procedure's parameters values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on row values.
public static ExecuteNonQueryTypedParams ( SqlConnection connection, String spName, DataRow dataRow ) : int
connection System.Data.SqlClient.SqlConnection A valid SqlConnection object
spName String The name of the stored procedure
dataRow System.Data.DataRow The dataRow used to hold the stored procedure's parameter values.
return int

ExecuteNonQueryTypedParams() public static method

Execute a stored procedure via a SqlCommand (that returns no resultset) against the specified SqlTransaction using the dataRow column values as the stored procedure's parameters values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on row values.
public static ExecuteNonQueryTypedParams ( SqlTransaction transaction, String spName, DataRow dataRow ) : int
transaction System.Data.SqlClient.SqlTransaction A valid SqlTransaction object
spName String The name of the stored procedure
dataRow System.Data.DataRow The dataRow used to hold the stored procedure's parameter values.
return int

ExecuteNonQueryTypedParams() public static method

Execute a stored procedure via a SqlCommand (that returns no resultset) against the database specified in the connection string using the dataRow column values as the stored procedure's parameters values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on row values.
public static ExecuteNonQueryTypedParams ( String connectionString, String spName, DataRow dataRow ) : int
connectionString String A valid connection string for a SqlConnection
spName String The name of the stored procedure
dataRow System.Data.DataRow The dataRow used to hold the stored procedure's parameter values.
return int

ExecuteReader() public static method

Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlConnection.
e.g.: SqlDataReader dr = ExecuteReader(conn, CommandType.StoredProcedure, "GetOrders");
public static ExecuteReader ( SqlConnection connection, CommandType commandType, string commandText ) : System.Data.SqlClient.SqlDataReader
connection System.Data.SqlClient.SqlConnection A valid SqlConnection
commandType CommandType The CommandType (stored procedure, text, etc.)
commandText string The stored procedure name or T-SQL command
return System.Data.SqlClient.SqlDataReader

ExecuteReader() public static method

Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlConnection using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: SqlDataReader dr = ExecuteReader(conn, "GetOrders", 24, 36);
public static ExecuteReader ( SqlConnection connection, string spName ) : System.Data.SqlClient.SqlDataReader
connection System.Data.SqlClient.SqlConnection A valid SqlConnection
spName string The name of the stored procedure
return System.Data.SqlClient.SqlDataReader

ExecuteReader() public static method

Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlTransaction.
e.g.: SqlDataReader dr = ExecuteReader(trans, CommandType.StoredProcedure, "GetOrders");
public static ExecuteReader ( SqlTransaction transaction, CommandType commandType, string commandText ) : System.Data.SqlClient.SqlDataReader
transaction System.Data.SqlClient.SqlTransaction A valid SqlTransaction
commandType CommandType The CommandType (stored procedure, text, etc.)
commandText string The stored procedure name or T-SQL command
return System.Data.SqlClient.SqlDataReader

ExecuteReader() public static method

Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlTransaction using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: SqlDataReader dr = ExecuteReader(trans, "GetOrders", 24, 36);
public static ExecuteReader ( SqlTransaction transaction, string spName ) : System.Data.SqlClient.SqlDataReader
transaction System.Data.SqlClient.SqlTransaction A valid SqlTransaction
spName string The name of the stored procedure
return System.Data.SqlClient.SqlDataReader

ExecuteReader() public static method

Execute a SqlCommand (that returns a resultset and takes no parameters) against the database specified in the connection string.
e.g.: SqlDataReader dr = ExecuteReader(connString, CommandType.StoredProcedure, "GetOrders");
public static ExecuteReader ( string connectionString, CommandType commandType, string commandText ) : System.Data.SqlClient.SqlDataReader
connectionString string A valid connection string for a SqlConnection
commandType CommandType The CommandType (stored procedure, text, etc.)
commandText string The stored procedure name or T-SQL command
return System.Data.SqlClient.SqlDataReader

ExecuteReader() public static method

Execute a stored procedure via a SqlCommand (that returns a resultset) against the database specified in the connection string using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: SqlDataReader dr = ExecuteReader(connString, "GetOrders", 24, 36);
public static ExecuteReader ( string connectionString, string spName ) : System.Data.SqlClient.SqlDataReader
connectionString string A valid connection string for a SqlConnection
spName string The name of the stored procedure
return System.Data.SqlClient.SqlDataReader

ExecuteReaderTypedParams() public static method

Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlConnection using the dataRow column values as the stored procedure's parameters values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
public static ExecuteReaderTypedParams ( SqlConnection connection, String spName, DataRow dataRow ) : System.Data.SqlClient.SqlDataReader
connection System.Data.SqlClient.SqlConnection A valid SqlConnection object
spName String The name of the stored procedure
dataRow System.Data.DataRow The dataRow used to hold the stored procedure's parameter values.
return System.Data.SqlClient.SqlDataReader

ExecuteReaderTypedParams() public static method

Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlTransaction using the dataRow column values as the stored procedure's parameters values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
public static ExecuteReaderTypedParams ( SqlTransaction transaction, String spName, DataRow dataRow ) : System.Data.SqlClient.SqlDataReader
transaction System.Data.SqlClient.SqlTransaction A valid SqlTransaction object
spName String The name of the stored procedure
dataRow System.Data.DataRow The dataRow used to hold the stored procedure's parameter values.
return System.Data.SqlClient.SqlDataReader

ExecuteReaderTypedParams() public static method

Execute a stored procedure via a SqlCommand (that returns a resultset) against the database specified in the connection string using the dataRow column values as the stored procedure's parameters values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
public static ExecuteReaderTypedParams ( String connectionString, String spName, DataRow dataRow ) : System.Data.SqlClient.SqlDataReader
connectionString String A valid connection string for a SqlConnection
spName String The name of the stored procedure
dataRow System.Data.DataRow The dataRow used to hold the stored procedure's parameter values.
return System.Data.SqlClient.SqlDataReader

ExecuteScalar() public static method

Execute a SqlCommand (that returns a 1x1 resultset and takes no parameters) against the provided SqlConnection.
e.g.: int orderCount = (int)ExecuteScalar(conn, CommandType.StoredProcedure, "GetOrderCount");
public static ExecuteScalar ( SqlConnection connection, CommandType commandType, string commandText ) : object
connection System.Data.SqlClient.SqlConnection A valid SqlConnection
commandType CommandType The CommandType (stored procedure, text, etc.)
commandText string The stored procedure name or T-SQL command
return object

ExecuteScalar() public static method

Execute a stored procedure via a SqlCommand (that returns a 1x1 resultset) against the specified SqlConnection using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: int orderCount = (int)ExecuteScalar(conn, "GetOrderCount", 24, 36);
public static ExecuteScalar ( SqlConnection connection, string spName ) : object
connection System.Data.SqlClient.SqlConnection A valid SqlConnection
spName string The name of the stored procedure
return object

ExecuteScalar() public static method

Execute a SqlCommand (that returns a 1x1 resultset and takes no parameters) against the provided SqlTransaction.
e.g.: int orderCount = (int)ExecuteScalar(trans, CommandType.StoredProcedure, "GetOrderCount");
public static ExecuteScalar ( SqlTransaction transaction, CommandType commandType, string commandText ) : object
transaction System.Data.SqlClient.SqlTransaction A valid SqlTransaction
commandType CommandType The CommandType (stored procedure, text, etc.)
commandText string The stored procedure name or T-SQL command
return object

ExecuteScalar() public static method

Execute a stored procedure via a SqlCommand (that returns a 1x1 resultset) against the specified SqlTransaction using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: int orderCount = (int)ExecuteScalar(trans, "GetOrderCount", 24, 36);
public static ExecuteScalar ( SqlTransaction transaction, string spName ) : object
transaction System.Data.SqlClient.SqlTransaction A valid SqlTransaction
spName string The name of the stored procedure
return object

ExecuteScalar() public static method

Execute a SqlCommand (that returns a 1x1 resultset and takes no parameters) against the database specified in the connection string.
e.g.: int orderCount = (int)ExecuteScalar(connString, CommandType.StoredProcedure, "GetOrderCount");
public static ExecuteScalar ( string connectionString, CommandType commandType, string commandText ) : object
connectionString string A valid connection string for a SqlConnection
commandType CommandType The CommandType (stored procedure, text, etc.)
commandText string The stored procedure name or T-SQL command
return object

ExecuteScalar() public static method

Execute a stored procedure via a SqlCommand (that returns a 1x1 resultset) against the database specified in the connection string using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: int orderCount = (int)ExecuteScalar(connString, "GetOrderCount", 24, 36);
public static ExecuteScalar ( string connectionString, string spName ) : object
connectionString string A valid connection string for a SqlConnection
spName string The name of the stored procedure
return object

ExecuteScalarTypedParams() public static method

Execute a stored procedure via a SqlCommand (that returns a 1x1 resultset) against the specified SqlConnection using the dataRow column values as the stored procedure's parameters values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
public static ExecuteScalarTypedParams ( SqlConnection connection, String spName, DataRow dataRow ) : object
connection System.Data.SqlClient.SqlConnection A valid SqlConnection object
spName String The name of the stored procedure
dataRow System.Data.DataRow The dataRow used to hold the stored procedure's parameter values.
return object

ExecuteScalarTypedParams() public static method

Execute a stored procedure via a SqlCommand (that returns a 1x1 resultset) against the specified SqlTransaction using the dataRow column values as the stored procedure's parameters values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
public static ExecuteScalarTypedParams ( SqlTransaction transaction, String spName, DataRow dataRow ) : object
transaction System.Data.SqlClient.SqlTransaction A valid SqlTransaction object
spName String The name of the stored procedure
dataRow System.Data.DataRow The dataRow used to hold the stored procedure's parameter values.
return object

ExecuteScalarTypedParams() public static method

Execute a stored procedure via a SqlCommand (that returns a 1x1 resultset) against the database specified in the connection string using the dataRow column values as the stored procedure's parameters values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
public static ExecuteScalarTypedParams ( String connectionString, String spName, DataRow dataRow ) : object
connectionString String A valid connection string for a SqlConnection
spName String The name of the stored procedure
dataRow System.Data.DataRow The dataRow used to hold the stored procedure's parameter values.
return object

ExecuteXmlReader() public static method

Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlConnection.
e.g.: XmlReader r = ExecuteXmlReader(conn, CommandType.StoredProcedure, "GetOrders");
public static ExecuteXmlReader ( SqlConnection connection, CommandType commandType, string commandText ) : XmlReader
connection System.Data.SqlClient.SqlConnection A valid SqlConnection
commandType CommandType The CommandType (stored procedure, text, etc.)
commandText string The stored procedure name or T-SQL command using "FOR XML AUTO"
return System.Xml.XmlReader

ExecuteXmlReader() public static method

Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlConnection using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: XmlReader r = ExecuteXmlReader(conn, "GetOrders", 24, 36);
public static ExecuteXmlReader ( SqlConnection connection, string spName ) : XmlReader
connection System.Data.SqlClient.SqlConnection A valid SqlConnection
spName string The name of the stored procedure using "FOR XML AUTO"
return System.Xml.XmlReader

ExecuteXmlReader() public static method

Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlTransaction.
e.g.: XmlReader r = ExecuteXmlReader(trans, CommandType.StoredProcedure, "GetOrders");
public static ExecuteXmlReader ( SqlTransaction transaction, CommandType commandType, string commandText ) : XmlReader
transaction System.Data.SqlClient.SqlTransaction A valid SqlTransaction
commandType CommandType The CommandType (stored procedure, text, etc.)
commandText string The stored procedure name or T-SQL command using "FOR XML AUTO"
return System.Xml.XmlReader

ExecuteXmlReader() public static method

Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlTransaction using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: XmlReader r = ExecuteXmlReader(trans, "GetOrders", 24, 36);
public static ExecuteXmlReader ( SqlTransaction transaction, string spName ) : XmlReader
transaction System.Data.SqlClient.SqlTransaction A valid SqlTransaction
spName string The name of the stored procedure
return System.Xml.XmlReader

ExecuteXmlReaderTypedParams() public static method

Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlConnection using the dataRow column values as the stored procedure's parameters values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
public static ExecuteXmlReaderTypedParams ( SqlConnection connection, String spName, DataRow dataRow ) : XmlReader
connection System.Data.SqlClient.SqlConnection A valid SqlConnection object
spName String The name of the stored procedure
dataRow System.Data.DataRow The dataRow used to hold the stored procedure's parameter values.
return System.Xml.XmlReader

ExecuteXmlReaderTypedParams() public static method

Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlTransaction using the dataRow column values as the stored procedure's parameters values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
public static ExecuteXmlReaderTypedParams ( SqlTransaction transaction, String spName, DataRow dataRow ) : XmlReader
transaction System.Data.SqlClient.SqlTransaction A valid SqlTransaction object
spName String The name of the stored procedure
dataRow System.Data.DataRow The dataRow used to hold the stored procedure's parameter values.
return System.Xml.XmlReader

FillDataset() public static method

Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlConnection.
e.g.: FillDataset(conn, CommandType.StoredProcedure, "GetOrders", ds, new string[] {"orders"});
public static FillDataset ( SqlConnection connection, CommandType commandType, string commandText, DataSet dataSet, string tableNames ) : void
connection System.Data.SqlClient.SqlConnection A valid SqlConnection
commandType CommandType The CommandType (stored procedure, text, etc.)
commandText string The stored procedure name or T-SQL command
dataSet System.Data.DataSet A dataset wich will contain the resultset generated by the command
tableNames string This array will be used to create table mappings allowing the DataTables to be referenced /// by a user defined name (probably the actual table name) ///
return void

FillDataset() public static method

Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlConnection using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: FillDataset(conn, "GetOrders", ds, new string[] {"orders"}, 24, 36);
public static FillDataset ( SqlConnection connection, string spName, DataSet dataSet, string tableNames ) : void
connection System.Data.SqlClient.SqlConnection A valid SqlConnection
spName string The name of the stored procedure
dataSet System.Data.DataSet A dataset wich will contain the resultset generated by the command
tableNames string This array will be used to create table mappings allowing the DataTables to be referenced /// by a user defined name (probably the actual table name) ///
return void

FillDataset() public static method

Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlTransaction.
e.g.: FillDataset(trans, CommandType.StoredProcedure, "GetOrders", ds, new string[] {"orders"});
public static FillDataset ( SqlTransaction transaction, CommandType commandType, string commandText, DataSet dataSet, string tableNames ) : void
transaction System.Data.SqlClient.SqlTransaction A valid SqlTransaction
commandType CommandType The CommandType (stored procedure, text, etc.)
commandText string The stored procedure name or T-SQL command
dataSet System.Data.DataSet A dataset wich will contain the resultset generated by the command
tableNames string This array will be used to create table mappings allowing the DataTables to be referenced /// by a user defined name (probably the actual table name) ///
return void

FillDataset() public static method

Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlTransaction using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: FillDataset(trans, "GetOrders", ds, new string[]{"orders"}, 24, 36);
public static FillDataset ( SqlTransaction transaction, string spName, DataSet dataSet, string tableNames ) : void
transaction System.Data.SqlClient.SqlTransaction A valid SqlTransaction
spName string The name of the stored procedure
dataSet System.Data.DataSet A dataset wich will contain the resultset generated by the command
tableNames string This array will be used to create table mappings allowing the DataTables to be referenced /// by a user defined name (probably the actual table name) ///
return void

FillDataset() public static method

Execute a SqlCommand (that returns a resultset and takes no parameters) against the database specified in the connection string.
e.g.: FillDataset(connString, CommandType.StoredProcedure, "GetOrders", ds, new string[] {"orders"});
public static FillDataset ( string connectionString, CommandType commandType, string commandText, DataSet dataSet, string tableNames ) : void
connectionString string A valid connection string for a SqlConnection
commandType CommandType The CommandType (stored procedure, text, etc.)
commandText string The stored procedure name or T-SQL command
dataSet System.Data.DataSet A dataset wich will contain the resultset generated by the command
tableNames string This array will be used to create table mappings allowing the DataTables to be referenced /// by a user defined name (probably the actual table name)
return void

FillDataset() public static method

Execute a stored procedure via a SqlCommand (that returns a resultset) against the database specified in the connection string using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
This method provides no access to output parameters or the stored procedure's return value parameter. e.g.: FillDataset(connString, CommandType.StoredProcedure, "GetOrders", ds, new string[] {"orders"}, 24);
public static FillDataset ( string connectionString, string spName, DataSet dataSet, string tableNames ) : void
connectionString string A valid connection string for a SqlConnection
spName string The name of the stored procedure
dataSet System.Data.DataSet A dataset wich will contain the resultset generated by the command
tableNames string This array will be used to create table mappings allowing the DataTables to be referenced /// by a user defined name (probably the actual table name) ///
return void

TableValuedToDB() public static method

批量插入
public static TableValuedToDB ( string _sqlConnStr, DataTable dt ) : void
_sqlConnStr string
dt System.Data.DataTable
return void

UpdateDataset() public static method

Executes the respective command for each inserted, updated, or deleted row in the DataSet.
e.g.: UpdateDataset(conn, insertCommand, deleteCommand, updateCommand, dataSet, "Order");
public static UpdateDataset ( SqlCommand insertCommand, SqlCommand deleteCommand, SqlCommand updateCommand, DataSet dataSet, string tableName ) : void
insertCommand System.Data.SqlClient.SqlCommand A valid transact-SQL statement or stored procedure to insert new records into the data source
deleteCommand System.Data.SqlClient.SqlCommand A valid transact-SQL statement or stored procedure to delete records from the data source
updateCommand System.Data.SqlClient.SqlCommand A valid transact-SQL statement or stored procedure used to update records in the data source
dataSet System.Data.DataSet The DataSet used to update the data source
tableName string The DataTable used to update the data source.
return void