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; } } } } }
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)); } }
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(); } } }
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); }
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); }