Android Question RollbackTransaction

b4auser1

Well-Known Member
Licensed User
Longtime User
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
 
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
Back
Top