Пример #1
0
        public ComCommand CreateCommand()
        {
            ComCommand cmd = new ComCommand();

            cmd.Command = _con.CreateCommand();
            return(cmd);
        }
Пример #2
0
        public int ExecuteNonQuery(CommandType commandType, string commandText, Param commandParameters)
        {
            ComCommand cmd = new ComCommand();

            PrepareCommand(cmd, commandType, commandText, commandParameters);
            int tmpValue = cmd.ExecuteNonQuery();

            cmd.Parameters.Clear();
            return(tmpValue);
        }
Пример #3
0
        public object ExecuteScalar(CommandType commandType, string commandText, Param commandParameters)
        {
            ComCommand cmd = new ComCommand();

            PrepareCommand(cmd, commandType, commandText, commandParameters);
            object tmpValue = cmd.ExecuteScalar();

            cmd.Parameters.Clear();
            return(tmpValue);
        }
Пример #4
0
        public ComDataReader ExecuteReader(CommandType commandType, string commandText, Param commandParameters)
        {
            ComCommand cmd = new ComCommand();

            PrepareCommand(cmd, commandType, commandText, commandParameters);
            ComDataReader dr = cmd.ExecuteReader();

            cmd.Parameters.Clear();
            return(dr);
        }
Пример #5
0
        public DataView ExecuteDataView(CommandType commandType, string commandText, Param commandParameters)
        {
            DataSet    ds  = new DataSet();
            ComCommand cmd = new ComCommand();

            PrepareCommand(cmd, commandType, commandText, commandParameters);

            ComDataAdapter da = new ComDataAdapter(cmd);

            da.Fill(ds, "MyTableName");

            cmd.Parameters.Clear();
            return(ds.Tables["MyTableName"].DefaultView);
        }
Пример #6
0
        public DataSet ExecuteDataset(CommandType commandType, string commandText, Param commandParameters, DataSet ds, string tableName)
        {
            ComCommand cmd = new ComCommand();

            PrepareCommand(cmd, commandType, commandText, commandParameters);
            ComDataAdapter da = new ComDataAdapter(cmd);

            if (Object.Equals(tableName, null) || (tableName.Length < 1))
            {
                da.Fill(ds);
            }
            else
            {
                da.Fill(ds, tableName);
            }
            cmd.Parameters.Clear();
            return(ds);
        }
Пример #7
0
 private void PrepareCommand(ComCommand cmd, CommandType commandType, string commandText, Param commandParameters)
 {
     cmd.CommandType = commandType;
     cmd.CommandText = commandText;
     cmd.Connection  = this._dbconn;
     if (trans == null)
     {
         cmd.Transaction = null;
     }
     else
     {
         cmd.Transaction = trans.Transaction;
     }
     if ((commandParameters != null) && (commandParameters.Count > 0))
     {
         for (int i = 0; i < commandParameters.Count; i++)
         {
             cmd.Parameters.AddWithValue(commandParameters[i].ParameterName, commandParameters[i].Value);
         }
     }
 }
Пример #8
0
 public ComDataAdapter(ComCommand cmd)
 {
     _da = new SqlDataAdapter(cmd.Command);
 }
Пример #9
0
 public ComDataAdapter(ComCommand cmd)
 {
     _da = new System.Data.OracleClient.OracleDataAdapter(cmd.Command);
 }