コード例 #1
0
 /// <summary>
 /// Executes the Sql Command and return resultset 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));
 }
コード例 #2
0
 /// <summary>
 /// Executes the Sql Command and returns the DataReader.
 /// </summary>
 /// <param name="commandText">Sql Command</param>
 /// <param name="con">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 con, DBParameter param)
 {
     return(ExecuteDataReader(commandText, con, param, CommandType.Text));
 }
コード例 #3
0
 /// <summary>
 /// Executes the Sql Command or Stored Procedure and return resultset in the form of DataTable.
 /// </summary>
 /// <param name="commandText">Sql Command or Stored Procedure Name</param>
 /// <param name="tableName">Table name</param>
 /// <param name="param">Parameter to be associated with the Command.</param>
 /// <param name="commandType">Type of command (i.e. Sql Command/ Stored Procedure name/ Table Direct)</param>
 /// <returns>Result in the form of DataTable</returns>
 public DataTable ExecuteDataTable(string commandText, string tableName, DBParameter param, CommandType commandType)
 {
     return(ExecuteDataTable(commandText, tableName, param, commandType));
 }
コード例 #4
0
 /// <summary>
 /// Executes the Sql Command and return resultset in the form of DataSet.
 /// </summary>
 /// <param name="commandText">Sql Command </param>
 /// <param name="param">Parameter to be associated with the command</param>
 /// <returns>Result in the form of DataSet</returns>
 public DataSet ExecuteDataSet(string commandText, DBParameter param)
 {
     return(ExecuteDataSet(commandText, param, CommandType.Text));
 }
コード例 #5
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, CommandType.Text));
 }
コード例 #6
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, CommandType.Text));
 }
コード例 #7
0
        internal IDataAdapter GetDataAdapter(string sqlCommand, IDbConnection connection, DBParameter param, CommandType commandType)
        {
            IDataAdapter adapter = null;
            IDbCommand   command = (new CommandBuilder()).GetCommand(sqlCommand, connection, param, commandType);

            switch (Configuration.DBProvider.Trim().ToUpper())
            {
            case Common.SQL_SERVER_DB_PROVIDER:
                adapter = new SqlDataAdapter((SqlCommand)command);
                break;

            case Common.MY_SQL_DB_PROVIDER:
                adapter = new MySqlDataAdapter((MySqlCommand)command);
                break;

            case Common.ORACLE_DB_PROVIDER:
                adapter = new OracleDataAdapter((OracleCommand)command);
                break;

            case Common.ACCESS_DB_PROVIDER:
                adapter = new OleDbDataAdapter((OleDbCommand)command);
                break;

            case Common.OLE_DB_PROVIDER:
                adapter = new OleDbDataAdapter((OleDbCommand)command);
                break;

            case Common.ODBC_DB_PROVIDER:
                adapter = new OdbcDataAdapter((OdbcCommand)command);
                break;
            }

            return(adapter);
        }