>It could be possible that this counter might be causing your problem. > >>How is this possible to get that error with this conditional code? > >Your application might call TDISQLite3Database.Execute('COMMIT');. But >since TDISQLite3Database.InTransaction only tracks those transactions >started and ended by the three methods listed above, this SQL-level COMMIT >goes unnoticed and TDISQLite3Database.Commit tries a 2nd commit which must >then fail. I did a scan of all my source code but could not find anywhere that I execute TDISQLite3Database.Execute('COMMIT') - or in my case Database.Execute('commit') Transactions are *always* started with Database.StartTransaction and finished with Database.commit So on the surface it would appear that somehow the counter is getting out of sync >I do not have another explanation except for those already pointed out OK, after reading your reply I have a better understanding of how transactions work at this database level. So that I can understand all the variables here, I submit the following hypothetical scenario (but I currently don't have in my application) Couldn't something like having a rollback conflict resolution also cause the counter to get out of sync? For example, take the following : Database.StartTransaction // execute an sql update that has a conflict resolution of Rollback and we get a conflict If Database.Intransaction then Database.commit In this case the transaction would have been rolled back by the conflict resolution, but because this is done at a lower level (sqlite) the TDisqlite3Database counter would not be updated? Perhaps this might trigger your thoughts on other examples where this could happen? As I said, I don't have any such conflict resolutions in my code, but if this scenario can cause the counter to get out of sync, then perhaps there are others that I am not aware of. The code base for my project where this happens is very large. However, I will keep trying to debug and see if I can narrow down how this error is possible Thanks Clyde _______________________________________________ Delphi Inspiration mailing list yunqa@xxxxxxxxxxxxx //www.freelists.org/list/yunqa