示例#1
0
 public void ExecuteNonQuery(List <string> commandTexts)
 {
     using (AccessPoolManager.AccessPool pool = AccessPoolManager.Instance(this.connectionString))
     {
         using (OleDbTransaction transaction = pool.Connection.BeginTransaction())
         {
             using (OleDbCommand command = new OleDbCommand())
             {
                 try
                 {
                     command.Connection  = pool.Connection;
                     command.Transaction = transaction;
                     foreach (string str in commandTexts)
                     {
                         command.CommandText = str;
                         command.ExecuteNonQuery();
                     }
                     transaction.Commit();
                 }
                 catch
                 {
                     transaction.Rollback();
                     throw;
                 }
             }
         }
     }
 }
示例#2
0
 public OleDbDataReader ExecuteReader(string commandText, OleDbParameter[] pt)
 {
     AccessPoolManager.AccessPool pool = AccessPoolManager.Instance(this.connectionString);
     using (OleDbCommand command = new OleDbCommand(commandText, pool.Connection))
     {
         if (pt != null)
         {
             command.Parameters.AddRange(pt);
         }
         return(command.ExecuteReader(CommandBehavior.CloseConnection));
     }
 }
示例#3
0
 public void ExecuteNonQuery(string commandText, OleDbParameter[] pt)
 {
     using (AccessPoolManager.AccessPool pool = AccessPoolManager.Instance(this.connectionString))
     {
         using (OleDbCommand command = new OleDbCommand(commandText, pool.Connection))
         {
             if (pt != null)
             {
                 command.Parameters.AddRange(pt);
             }
             command.ExecuteNonQuery();
         }
     }
 }
示例#4
0
        public DataTable ExecuteDataTable(string commandText, OleDbParameter[] pt)
        {
            DataTable dataTable = new DataTable();

            using (AccessPoolManager.AccessPool pool = AccessPoolManager.Instance(this.connectionString))
            {
                using (OleDbDataAdapter adapter = new OleDbDataAdapter(commandText, pool.Connection))
                {
                    if (pt != null)
                    {
                        adapter.SelectCommand.Parameters.AddRange(pt);
                    }
                    adapter.Fill(dataTable);
                }
            }
            return(dataTable);
        }
示例#5
0
        public object ExecuteScalar(string commandText, OleDbParameter[] pt)
        {
            object obj2;

            using (AccessPoolManager.AccessPool pool = AccessPoolManager.Instance(this.connectionString))
            {
                using (OleDbCommand command = new OleDbCommand(commandText, pool.Connection))
                {
                    if (pt != null)
                    {
                        command.Parameters.AddRange(pt);
                    }
                    obj2 = command.ExecuteScalar();
                }
            }
            return(obj2);
        }