Пример #1
0
 /// <summary>
 /// Prepares command for the passed SQL Command.
 /// 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</param>
 /// <param name="parameter">Database parameter</param>
 /// <returns>Command ready for execute</returns>
 public IDbCommand GetCommand(string commandText, DBParameter parameter)
 {
     return(GetCommand(commandText, parameter, CommandType.Text));
 }
Пример #2
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="param">Database Parameter</param>
 /// <param name="transaction">Database Transaction (Use DBHelper.Transaction property for getting the transaction.)</param>
 /// <returns>Data Reader</returns>
 public IDataReader ExecuteDataReader(string commandText, DBParameter param, IDbTransaction transaction)
 {
     return(ExecuteDataReader(commandText, param, transaction, CommandType.Text));
 }
Пример #3
0
 /// <summary>
 /// Executes the Sql Command and returns result.
 /// </summary>
 /// <param name="commandText">Sql Command</param>
 /// <param name="param">Parameter to be associated</param>
 /// <param name="transaction">Database Transaction</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, DBParameter param, IDbTransaction transaction)
 {
     return(ExecuteScalar(commandText, param, transaction, CommandType.Text));
 }
Пример #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="param">Parameter to be associated with the Sql Command.</param>
 /// <returns>DataReader</returns>
 public IDataReader ExecuteDataReader(string commandText, IDbConnection connection, DBParameter param)
 {
     return(ExecuteDataReader(commandText, connection, param, CommandType.Text));
 }
Пример #5
0
 /// <summary>
 /// Executes the Sql Command and returns result.
 /// </summary>
 /// <param name="commandText">Sql Command</param>
 /// <param name="param">Parameter 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, DBParameter param)
 {
     return(ExecuteScalar(commandText, param, null));
 }
Пример #6
0
 /// <summary>
 /// Executes Sql Command or Stored procedure and returns number of rows affected.
 /// </summary>
 /// <param name="commandText">Sql Command</param>
 /// <param name="param">Parameter 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, DBParameter param, IDbTransaction transaction)
 {
     return(ExecuteNonQuery(commandText, param, transaction, CommandType.Text));
 }
Пример #7
0
 /// <summary>
 /// Executes Sql Command and returns number of rows effected.
 /// </summary>
 /// <param name="commandText">Sql Command</param>
 /// <param name="param">Parameter to be associated with the command</param>
 /// <returns>Number of rows effected.</returns>
 public int ExecuteNonQuery(string commandText, DBParameter param)
 {
     return(ExecuteNonQuery(commandText, param, null));
 }
Пример #8
0
        /// <summary>
        /// Executes the Sql Command or Stored Procedure and returns the DataReader.
        /// </summary>
        /// <param name="commandText">Sql Command or Stored Procedure Name</param>
        /// <param name="connection">Database Connection object (DBHelper.GetConnObject() may be used)</param>
        /// <param name="param">Parameter to be associated with the Sql Command or Stored Procedure.</param>
        /// <param name="commandType">Type of command (i.e. Sql Command/ Stored Procedure name/ Table Direct)</param>
        /// <returns>DataReader</returns>
        public IDataReader ExecuteDataReader(string commandText, IDbConnection connection, DBParameter param, CommandType commandType)
        {
            var paramCollection = new DbParameterCollection {
                param
            };

            return(ExecuteDataReader(commandText, connection, paramCollection, commandType));
        }
Пример #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="param">Parameter to be associated with the Command.</param>
 /// <returns>Result in the form of DataTable</returns>
 public DataTable ExecuteDataTable(string commandText, DBParameter param)
 {
     return(ExecuteDataTable(commandText, string.Empty, param, CommandType.Text));
 }