B b4auser1 Well-Known Member Licensed User Longtime User Jan 25, 2014 #1 I didn't find RollbackTransaction method in SQL library, only TransactionSuccessful for commit Code: Public Sub Commit () m_dbSQL.TransactionSuccessful m_dbSQL.EndTransaction End Sub Could I use the code shown below ? Code: Public Sub Rollback () m_dbSQL.ExecQuery("ROLLBACK") m_dbSQL.EndTransaction End Sub
I didn't find RollbackTransaction method in SQL library, only TransactionSuccessful for commit Code: Public Sub Commit () m_dbSQL.TransactionSuccessful m_dbSQL.EndTransaction End Sub Could I use the code shown below ? Code: Public Sub Rollback () m_dbSQL.ExecQuery("ROLLBACK") m_dbSQL.EndTransaction End Sub
M Mahares Expert Licensed User Longtime User Jan 25, 2014 #2 Try something like this: Code: 'Below will not commit, but rolls back SQL1.BeginTransaction txt="DELETE FROM MyTable WHERE product = 'orange'" SQL1.ExecNonQuery(txt) txt="ROLLBACK" SQL1.ExecNonQuery(txt) Code: 'Below will commit and deletes SQL1.BeginTransaction txt="DELETE FROM MyTable WHERE product = 'orange'" SQL1.ExecNonQuery(txt) 'txt="ROLLBACK" 'SQL1.ExecNonQuery(txt) SQL1.TransactionSuccessful SQL1.EndTransaction Upvote 0
Try something like this: Code: 'Below will not commit, but rolls back SQL1.BeginTransaction txt="DELETE FROM MyTable WHERE product = 'orange'" SQL1.ExecNonQuery(txt) txt="ROLLBACK" SQL1.ExecNonQuery(txt) Code: 'Below will commit and deletes SQL1.BeginTransaction txt="DELETE FROM MyTable WHERE product = 'orange'" SQL1.ExecNonQuery(txt) 'txt="ROLLBACK" 'SQL1.ExecNonQuery(txt) SQL1.TransactionSuccessful SQL1.EndTransaction
Erel B4X founder Staff member Licensed User Longtime User Jan 26, 2014 #3 @Mahares is correct. However there should be a SQL1.EndTransaction in the first example. EndTransaction without TransactionSuccessful = Roll back. Upvote 0
@Mahares is correct. However there should be a SQL1.EndTransaction in the first example. EndTransaction without TransactionSuccessful = Roll back.