Ejemplo n.º 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;
                 }
             }
         }
     }
 }
Ejemplo n.º 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));
     }
 }
Ejemplo n.º 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();
         }
     }
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }