Ejemplo n.º 1
0
 public IDbCommand GetCommand(string commandText, DbParameterCollection parameterCollection, IDbTransaction transaction)
 {
     return(GetCommand(commandText, parameterCollection, transaction, CommandType.Text));
 }
Ejemplo n.º 2
0
        public IDbCommand GetCommand(string commandText, IDbConnection connection, CommandType commandType, DbParameterCollection parameterCollection)
        {
            var command = GetCommand();

            command.CommandText = commandText;
            command.Connection  = connection;
            command.CommandType = commandType;

            if (parameterCollection != null)
            {
                var paramArray = _paramBuilder.GetParameterCollection(parameterCollection);

                foreach (var param in paramArray)
                {
                    command.Parameters.Add(param);
                }
            }

            return(command);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Prepares command for the passed SQL Command or Stored Procedure.
 /// Command is prepared for SQL Command only not for the stored procedures.
 /// Use DisposeCommand method after use of the command.
 /// </summary>
 /// <param name="commandText">SQL Command or Stored Procedure name</param>
 /// <param name="parameterCollection">Database parameter collection</param>
 /// <param name="commandType">Type of Command i.e. Text or Stored Procedure</param>
 /// <returns>Command ready for execute</returns>
 public IDbCommand GetCommand(string commandText, DbParameterCollection parameterCollection, CommandType commandType)
 {
     return(GetCommand(commandText, parameterCollection, null, commandType));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Executes the Sql Command and returns the DataReader.
 /// </summary>
 /// <param name="commandText">Sql Command</param>
 /// <param name="connection">Database Connection object (DBHelper.GetConnObject() may be used)</param>
 /// <param name="paramCollection">Parameter to be associated with the Sql Command or Stored Procedure.</param>
 /// <returns>DataReader</returns>
 public IDataReader ExecuteDataReader(string commandText, IDbConnection connection, DbParameterCollection paramCollection)
 {
     return(ExecuteDataReader(commandText, connection, paramCollection, CommandType.Text));
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Executes the Sql Command and returns result.
 /// </summary>
 /// <param name="commandText">Sql Command</param>
 /// <param name="paramCollection">Parameter collection to be associated.</param>
 /// <returns>A single value. (First row's first cell value, if more than one row and column is returned.)</returns>
 public object ExecuteScalar(string commandText, DbParameterCollection paramCollection)
 {
     return(ExecuteScalar(commandText, paramCollection, null));
 }
Ejemplo n.º 6
0
 /// <summary>
 ///  Executes the Sql Command and returns result.
 /// </summary>
 /// <param name="commandText">Sql Command</param>
 /// <param name="paramCollection">Database  Parameter Collection</param>
 /// <param name="transaction">Database Transaction (Use DBHelper.Transaction property.)</param>
 /// <returns></returns>
 public object ExecuteScalar(string commandText, DbParameterCollection paramCollection, IDbTransaction transaction)
 {
     return(ExecuteScalar(commandText, paramCollection, transaction, CommandType.Text));
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Executes Sql Command and returns number of rows affected.
 /// </summary>
 /// <param name="commandText">Sql Command</param>
 /// <param name="paramCollection">Parameter Collection to be associated with the command</param>
 /// <param name="transaction">Current Database Transaction (Use Helper.Transaction to get transaction)</param>
 /// <returns>Number of rows affected.</returns>
 public int ExecuteNonQuery(string commandText, DbParameterCollection paramCollection, IDbTransaction transaction)
 {
     return(ExecuteNonQuery(commandText, paramCollection, transaction, CommandType.Text));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Executes Sql Command and returns number of rows effected.
 /// </summary>
 /// <param name="commandText">Sql Command</param>
 /// <param name="paramCollection">Parameter Collection to be associated with the command</param>
 /// <returns>Number of rows effected.</returns>
 public int ExecuteNonQuery(string commandText, DbParameterCollection paramCollection)
 {
     return(ExecuteNonQuery(commandText, paramCollection, null));
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Executes the Sql Command and return result set in the form of DataTable.
 /// </summary>
 /// <param name="commandText">Sql Command</param>
 /// <param name="paramCollection">Parameter collection to be associated with the Command.</param>
 /// <returns>Result in the form of DataTable</returns>
 public DataTable ExecuteDataTable(string commandText, DbParameterCollection paramCollection)
 {
     return(ExecuteDataTable(commandText, string.Empty, paramCollection, CommandType.Text));
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Executes the Sql Command and return result set in the form of DataSet.
 /// </summary>
 /// <param name="commandText">Sql Command </param>
 /// <param name="paramCollection">Parameter collection to be associated with the command</param>
 /// <returns>Result in the form of DataSet</returns>
 public DataSet ExecuteDataSet(string commandText, DbParameterCollection paramCollection)
 {
     return(ExecuteDataSet(commandText, paramCollection, CommandType.Text));
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Executes the Sql Command and returns the IDataReader. Do remember to Commit or Rollback the transaction
 /// </summary>
 /// <param name="commandText">Sql Command </param>
 /// <param name="paramCollection">Database Parameter Collection</param>
 /// <param name="transaction">Database Transaction (Use DBHelper.Transaction property for getting the transaction.)</param>
 /// <returns>IDataReader</returns>
 public IDataReader ExecuteDataReader(string commandText, DbParameterCollection paramCollection, IDbTransaction transaction)
 {
     return(ExecuteDataReader(commandText, paramCollection, transaction, CommandType.Text));
 }