C# Класс Goldtect.ASTreeViewDemo.OleDbHelper

The OleDbHelper class is intended to encapsulate high performance, scalable best practices for common uses of OleDbClient.
Показать файл Открыть проект

Открытые методы

Метод Описание
ExecuteDataset ( System.Data.OleDb.OleDbConnection connection, CommandType commandType, string commandText ) : DataSet

Execute an OleDbCommand (that returns a resultset and takes no parameters) against the provided OleDbConnection.

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

ExecuteDataset ( System.Data.OleDb.OleDbConnection connection, string spName ) : DataSet

Execute a stored procedure via an OleDbCommand (that returns a resultset) against the specified OleDbConnection 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 ( System.Data.OleDb.OleDbTransaction transaction, CommandType commandType, string commandText ) : DataSet

Execute an OleDbCommand (that returns a resultset and takes no parameters) against the provided OleDbTransaction.

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

ExecuteDataset ( System.Data.OleDb.OleDbTransaction transaction, string spName ) : DataSet

Execute a stored procedure via an OleDbCommand (that returns a resultset) against the specified OleDbTransaction 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 an OleDbCommand (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 an OleDbCommand (that returns a resultset) against the database specified in the conneciton 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);

ExecuteNonQuery ( System.Data.OleDb.OleDbConnection connection, CommandType commandType, string commandText ) : int

Execute an OleDbDbCommand (that returns no resultset and takes no parameters) against the provided OleDbConnection.

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

ExecuteNonQuery ( System.Data.OleDb.OleDbConnection connection, string spName ) : int

Execute a stored procedure via an OleDbCommand (that returns no resultset) against the specified OleDbConnection 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 ( System.Data.OleDb.OleDbTransaction transaction, CommandType commandType, string commandText ) : int

Execute an OleDbCommand (that returns no resultset and takes no parameters) against the provided OleDbTransaction.

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

ExecuteNonQuery ( System.Data.OleDb.OleDbTransaction transaction, string spName ) : int

Execute a stored procedure via an OleDbCommand (that returns no resultset) against the specified OleDbTransaction 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 an OleDbCommand (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 an OleDbCommand (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);

ExecuteReader ( System.Data.OleDb.OleDbConnection connection, CommandType commandType, string commandText ) : System.Data.OleDb.OleDbDataReader

Execute an OleDbCommand (that returns a resultset and takes no parameters) against the provided OleDbConnection.

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

ExecuteReader ( System.Data.OleDb.OleDbConnection connection, string spName ) : System.Data.OleDb.OleDbDataReader

Execute a stored procedure via an OleDbCommand (that returns a resultset) against the specified OleDbConnection 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.: OleDbDataReader dr = ExecuteReader(conn, "GetOrders", 24, 36);

ExecuteReader ( System.Data.OleDb.OleDbTransaction transaction, CommandType commandType, string commandText ) : System.Data.OleDb.OleDbDataReader

Execute an OleDbCommand (that returns a resultset and takes no parameters) against the provided OleDbTransaction.

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

ExecuteReader ( System.Data.OleDb.OleDbTransaction transaction, string spName ) : System.Data.OleDb.OleDbDataReader

Execute a stored procedure via an OleDbCommand (that returns a resultset) against the specified OleDbTransaction 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.: OleDbDataReader dr = ExecuteReader(trans, "GetOrders", 24, 36);

ExecuteReader ( string connectionString, CommandType commandType, string commandText ) : System.Data.OleDb.OleDbDataReader

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

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

ExecuteReader ( string connectionString, string spName ) : System.Data.OleDb.OleDbDataReader

Execute a stored procedure via an OleDbCommand (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.: OleDbDataReader dr = ExecuteReader(connString, "GetOrders", 24, 36);

ExecuteScalar ( System.Data.OleDb.OleDbConnection connection, CommandType commandType, string commandText ) : object

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

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

ExecuteScalar ( System.Data.OleDb.OleDbConnection connection, string spName ) : object

Execute a stored procedure via a OleDbCommand (that returns a 1x1 resultset) against the specified OleDbConnection 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 ( System.Data.OleDb.OleDbTransaction transaction, CommandType commandType, string commandText ) : object

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

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

ExecuteScalar ( System.Data.OleDb.OleDbTransaction transaction, string spName ) : object

Execute a stored procedure via a OleDbCommand (that returns a 1x1 resultset) against the specified OleDbTransaction 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 OleDbCommand (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 OleDbCommand (that returns a 1x1 resultset) against the database specified in the conneciton 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);

Приватные методы

Метод Описание
AssignParameterValues ( System.Data.OleDb.OleDbParameter commandParameters, object parameterValues ) : void

This method assigns an array of values to an array of OleDbParameters.

AttachParameters ( OleDbCommand command, System.Data.OleDb.OleDbParameter commandParameters ) : void

This method is used to attach array's of OleDbParameters to an OleDbCommand. 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 ( System.Data.OleDb.OleDbConnection connection, System.Data.OleDb.OleDbTransaction transaction, CommandType commandType, string commandText, System.Data.OleDb.OleDbParameter commandParameters, OleDbConnectionOwnership connectionOwnership ) : System.Data.OleDb.OleDbDataReader

Create and prepare an OleDbCommand, 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.

OleDbHelper ( ) : System
PrepareCommand ( OleDbCommand command, System.Data.OleDb.OleDbConnection connection, System.Data.OleDb.OleDbTransaction transaction, CommandType commandType, string commandText, System.Data.OleDb.OleDbParameter commandParameters ) : void

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

Описание методов

ExecuteDataset() публичный статический Метод

Execute an OleDbCommand (that returns a resultset and takes no parameters) against the provided OleDbConnection.
e.g.: DataSet ds = ExecuteDataset(conn, CommandType.StoredProcedure, "GetOrders");
public static ExecuteDataset ( System.Data.OleDb.OleDbConnection connection, CommandType commandType, string commandText ) : DataSet
connection System.Data.OleDb.OleDbConnection a valid OleDbConnection
commandType CommandType the CommandType (stored procedure, text, etc.)
commandText string the stored procedure name or PL/SQL command
Результат System.Data.DataSet

ExecuteDataset() публичный статический Метод

Execute a stored procedure via an OleDbCommand (that returns a resultset) against the specified OleDbConnection 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 ( System.Data.OleDb.OleDbConnection connection, string spName ) : DataSet
connection System.Data.OleDb.OleDbConnection a valid OleDbConnection
spName string the name of the stored prcedure
Результат System.Data.DataSet

ExecuteDataset() публичный статический Метод

Execute an OleDbCommand (that returns a resultset and takes no parameters) against the provided OleDbTransaction.
e.g.: DataSet ds = ExecuteDataset(trans, CommandType.StoredProcedure, "GetOrders");
public static ExecuteDataset ( System.Data.OleDb.OleDbTransaction transaction, CommandType commandType, string commandText ) : DataSet
transaction System.Data.OleDb.OleDbTransaction a valid OleDbTransaction
commandType CommandType the CommandType (stored procedure, text, etc.)
commandText string the stored procedure name or PL/SQL command
Результат System.Data.DataSet

ExecuteDataset() публичный статический Метод

Execute a stored procedure via an OleDbCommand (that returns a resultset) against the specified OleDbTransaction 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 ( System.Data.OleDb.OleDbTransaction transaction, string spName ) : DataSet
transaction System.Data.OleDb.OleDbTransaction a valid OleDbTransaction
spName string the name of the stored prcedure
Результат System.Data.DataSet

ExecuteDataset() публичный статический Метод

Execute an OleDbCommand (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 an OleDbConnection
commandType CommandType the CommandType (stored procedure, text, etc.)
commandText string the stored procedure name or PL/SQL command
Результат System.Data.DataSet

ExecuteDataset() публичный статический Метод

Execute a stored procedure via an OleDbCommand (that returns a resultset) against the database specified in the conneciton 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 an OleDbConnection
spName string the name of the stored procedure
Результат System.Data.DataSet

ExecuteNonQuery() публичный статический Метод

Execute an OleDbDbCommand (that returns no resultset and takes no parameters) against the provided OleDbConnection.
e.g.: int result = ExecuteNonQuery(conn, CommandType.StoredProcedure, "PublishOrders");
public static ExecuteNonQuery ( System.Data.OleDb.OleDbConnection connection, CommandType commandType, string commandText ) : int
connection System.Data.OleDb.OleDbConnection a valid OleDbConnection
commandType CommandType the CommandType (stored procedure, text, etc.)
commandText string the stored procedure name or PL/SQL command
Результат int

ExecuteNonQuery() публичный статический Метод

Execute a stored procedure via an OleDbCommand (that returns no resultset) against the specified OleDbConnection 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 ( System.Data.OleDb.OleDbConnection connection, string spName ) : int
connection System.Data.OleDb.OleDbConnection a valid OleDbConnection
spName string the name of the stored prcedure
Результат int

ExecuteNonQuery() публичный статический Метод

Execute an OleDbCommand (that returns no resultset and takes no parameters) against the provided OleDbTransaction.
e.g.: int result = ExecuteNonQuery(trans, CommandType.StoredProcedure, "PublishOrders");
public static ExecuteNonQuery ( System.Data.OleDb.OleDbTransaction transaction, CommandType commandType, string commandText ) : int
transaction System.Data.OleDb.OleDbTransaction a valid OleDbTransaction
commandType CommandType the CommandType (stored procedure, text, etc.)
commandText string the stored procedure name or PL/SQL command
Результат int

ExecuteNonQuery() публичный статический Метод

Execute a stored procedure via an OleDbCommand (that returns no resultset) against the specified OleDbTransaction 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 ( System.Data.OleDb.OleDbTransaction transaction, string spName ) : int
transaction System.Data.OleDb.OleDbTransaction a valid OleDbTransaction
spName string the name of the stored procedure
Результат int

ExecuteNonQuery() публичный статический Метод

Execute an OleDbCommand (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 an OleDbConnection
commandType CommandType the CommandType (stored procedure, text, etc.)
commandText string the stored procedure name or PL/SQL command
Результат int

ExecuteNonQuery() публичный статический Метод

Execute a stored procedure via an OleDbCommand (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 OleDbConnection
spName string the name of the stored prcedure
Результат int

ExecuteReader() публичный статический Метод

Execute an OleDbCommand (that returns a resultset and takes no parameters) against the provided OleDbConnection.
e.g.: OleDbDataReader dr = ExecuteReader(conn, CommandType.StoredProcedure, "GetOrders");
public static ExecuteReader ( System.Data.OleDb.OleDbConnection connection, CommandType commandType, string commandText ) : System.Data.OleDb.OleDbDataReader
connection System.Data.OleDb.OleDbConnection a valid OleDbConnection
commandType CommandType the CommandType (stored procedure, text, etc.)
commandText string the stored procedure name or PL/SQL command
Результат System.Data.OleDb.OleDbDataReader

ExecuteReader() публичный статический Метод

Execute a stored procedure via an OleDbCommand (that returns a resultset) against the specified OleDbConnection 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.: OleDbDataReader dr = ExecuteReader(conn, "GetOrders", 24, 36);
public static ExecuteReader ( System.Data.OleDb.OleDbConnection connection, string spName ) : System.Data.OleDb.OleDbDataReader
connection System.Data.OleDb.OleDbConnection a valid OleDbConnection
spName string the name of the stored procedure
Результат System.Data.OleDb.OleDbDataReader

ExecuteReader() публичный статический Метод

Execute an OleDbCommand (that returns a resultset and takes no parameters) against the provided OleDbTransaction.
e.g.: OleDbDataReader dr = ExecuteReader(trans, CommandType.StoredProcedure, "GetOrders");
public static ExecuteReader ( System.Data.OleDb.OleDbTransaction transaction, CommandType commandType, string commandText ) : System.Data.OleDb.OleDbDataReader
transaction System.Data.OleDb.OleDbTransaction a valid OleDbTransaction
commandType CommandType the CommandType (stored procedure, text, etc.)
commandText string the stored procedure name or PL/SQL command
Результат System.Data.OleDb.OleDbDataReader

ExecuteReader() публичный статический Метод

Execute a stored procedure via an OleDbCommand (that returns a resultset) against the specified OleDbTransaction 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.: OleDbDataReader dr = ExecuteReader(trans, "GetOrders", 24, 36);
public static ExecuteReader ( System.Data.OleDb.OleDbTransaction transaction, string spName ) : System.Data.OleDb.OleDbDataReader
transaction System.Data.OleDb.OleDbTransaction a valid OleDbTransaction
spName string the name of the stored prcedure
Результат System.Data.OleDb.OleDbDataReader

ExecuteReader() публичный статический Метод

Execute an OleDbCommand (that returns a resultset and takes no parameters) against the database specified in the connection string.
e.g.: OleDbDataReader dr = ExecuteReader(connString, CommandType.StoredProcedure, "GetOrders");
public static ExecuteReader ( string connectionString, CommandType commandType, string commandText ) : System.Data.OleDb.OleDbDataReader
connectionString string a valid connection string for an OleDbConnection
commandType CommandType the CommandType (stored procedure, text, etc.)
commandText string the stored procedure name or PL/SQL command
Результат System.Data.OleDb.OleDbDataReader

ExecuteReader() публичный статический Метод

Execute a stored procedure via an OleDbCommand (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.: OleDbDataReader dr = ExecuteReader(connString, "GetOrders", 24, 36);
public static ExecuteReader ( string connectionString, string spName ) : System.Data.OleDb.OleDbDataReader
connectionString string a valid connection string for an OleDbConnection
spName string the name of the stored prcedure
Результат System.Data.OleDb.OleDbDataReader

ExecuteScalar() публичный статический Метод

Execute a OleDbCommand (that returns a 1x1 resultset and takes no parameters) against the provided OleDbConnection.
e.g.: int orderCount = (int)ExecuteScalar(conn, CommandType.StoredProcedure, "GetOrderCount");
public static ExecuteScalar ( System.Data.OleDb.OleDbConnection connection, CommandType commandType, string commandText ) : object
connection System.Data.OleDb.OleDbConnection a valid OleDbConnection
commandType CommandType the CommandType (stored procedure, text, etc.)
commandText string the stored procedure name or T-OleDb command
Результат object

ExecuteScalar() публичный статический Метод

Execute a stored procedure via a OleDbCommand (that returns a 1x1 resultset) against the specified OleDbConnection 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 ( System.Data.OleDb.OleDbConnection connection, string spName ) : object
connection System.Data.OleDb.OleDbConnection a valid OleDbConnection
spName string the name of the stored prcedure
Результат object

ExecuteScalar() публичный статический Метод

Execute a OleDbCommand (that returns a 1x1 resultset and takes no parameters) against the provided OleDbTransaction.
e.g.: int orderCount = (int)ExecuteScalar(trans, CommandType.StoredProcedure, "GetOrderCount");
public static ExecuteScalar ( System.Data.OleDb.OleDbTransaction transaction, CommandType commandType, string commandText ) : object
transaction System.Data.OleDb.OleDbTransaction a valid OleDbTransaction
commandType CommandType the CommandType (stored procedure, text, etc.)
commandText string the stored procedure name or T-OleDb command
Результат object

ExecuteScalar() публичный статический Метод

Execute a stored procedure via a OleDbCommand (that returns a 1x1 resultset) against the specified OleDbTransaction 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 ( System.Data.OleDb.OleDbTransaction transaction, string spName ) : object
transaction System.Data.OleDb.OleDbTransaction a valid OleDbTransaction
spName string the name of the stored prcedure
Результат object

ExecuteScalar() публичный статический Метод

Execute a OleDbCommand (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 OleDbConnection
commandType CommandType the CommandType (stored procedure, text, etc.)
commandText string the stored procedure name or T-OleDb command
Результат object

ExecuteScalar() публичный статический Метод

Execute a stored procedure via a OleDbCommand (that returns a 1x1 resultset) against the database specified in the conneciton 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 OleDbConnection
spName string the name of the stored prcedure
Результат object