Rollback is automatic if no Commit is issued in SQLite.NET. If you want custom logic, such as including additional exception information, then use try/catch
BeginTransaction(); try { .. Commit(); } catch(Exception ex) { RollBack(); throw new Exception("An exception occurred and the transaction has been rolled back.", ex); } HTH, Sam ------------------------------------------- We're Hiring! Seeking a passionate developer to join our team building products. Position is in the Washington D.C. metro area. If interested contact [EMAIL PROTECTED] -----Original Message----- From: Ahmed Sulaiman [mailto:[EMAIL PROTECTED] Sent: Monday, July 16, 2007 10:52 AM To: sqlite-users@sqlite.org Subject: [sqlite] Does Transaction object roll back automatically on exceptions? Hi all, I have tried this question in the forum with no answer, so I decide to give it a try here :) I am using the "Using" statements in C# to handle the closing of SQLite connection, transaction and command objects. I have this setup in different places in my code (Generic methods returning SQLite objects) using (IDbConnection conn = CreateConnection()) { conn.Open(); using (IDbTransaction transaction = conn.BeginTransaction()) { Dosomething(); transaction.Commit(); } } My question, what happens if there was an exception inside the transaction using block? I know that the transaction object would be closed and disposed, but does the traction roll back automatically by the SQLite engine, or do I need to have special logic for that? What is the suggested best practices in this case? Cheers ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------