public bool ExecuteTransaction() { if (!Connection()) { return(false); } SqlTransaction transaction = CN.BeginTransaction(); try { foreach (SqlCommand cmd in TransactionCommands) { cmd.Transaction = transaction; cmd.ExecuteNonQuery(); } transaction.Commit(); return(true); } catch (Exception ex) { transaction.Rollback(); _error = ex.Message; } return(false); }