public int ExecutePreparedStatementNonQuery(IPreparedStatement stmt, IsolationLevel isolationLevel) { SqlCommand command = stmt.GetCommand(); SqlTransaction transaction = connection.BeginTransaction(isolationLevel); command.Transaction = transaction; try { int rows = command.ExecuteNonQuery(); transaction.Commit(); return(rows); } catch (Exception ex) { Debug.WriteLine(ex.ToString()); try { transaction.Rollback(); } catch (Exception ex2) { Debug.WriteLine(ex2.ToString()); return(-1); } return(-1); } }
public SqlDataReader ExecutePreparedStatementReader(IPreparedStatement stmt, IsolationLevel isolationLevel) { SqlCommand command = stmt.GetCommand(); SqlTransaction transaction = connection.BeginTransaction(isolationLevel); command.Transaction = transaction; SqlDataReader reader; try { reader = command.ExecuteReader(); //transaction.Commit(); return(reader); } catch (Exception ex) { Debug.WriteLine(ex.ToString()); try { //transaction.Rollback(); } catch (Exception ex2) { Debug.WriteLine(ex2.ToString()); return(null); } return(null); } }
public int ExecutePreparedStatementNonQuery(IPreparedStatement stmt) { SqlCommand command = stmt.GetCommand(); try { int rows = command.ExecuteNonQuery(); return(rows); } catch (Exception ex) { Debug.WriteLine(ex.ToString()); return(-1); } }
public SqlDataReader ExecutePreparedStatementReader(IPreparedStatement stmt) { SqlCommand command = stmt.GetCommand(); try { SqlDataReader reader = command.ExecuteReader(); return(reader); } catch (Exception ex) { Debug.WriteLine(ex.ToString()); return(null); } }