2

I have trouble using the transactionscope on SQLite, i am using the following code. Changes are still commited to the database while i don't call the ts.Complete() function.

Using ts As New System.Transactions.TransactionScope()  
  Using sharedConnectionScope As New SubSonic.SharedDbConnectionScope()
  ' Do your individual saves here' 
  If all OK      
    ts.Complete()   
  End Using
End Using

1 Answers1

0

If I recall correctly, you're going to need to call BeginTransaction and EndTransaction somewhere in there to tell SQLite that you're entering and subsequently leaving a transaction block--if I recall correctly, wrapping a (using transaction As IDbCommand.BeginTransaction ()) around any transaction-based code is necessary (though I haven't done ADO.NET in a while).

Bojan Rajkovic
  • 1,686
  • 11
  • 14
  • 2
    No, not necessary if you're using a TransactionScope like this. – David M Jul 24 '09 at 06:57
  • It does work though, but i still think the previous method should work on subsonic. I don't know if it is an bug in subsonic or in the SQLite ado.net profider –  Jul 24 '09 at 07:04
  • most probably it is SQLite ADO.net Provider – TheVillageIdiot Jul 24 '09 at 07:18
  • Yeah, I looked up TransactionScope this morning and saw that technically, you don't need to BeginTransaction/EndTransaction specifically. +1 for it being a bug in the ADO.NET provider. – Bojan Rajkovic Jul 24 '09 at 15:32
  • 2
    Could you post the code you ended up using as the solution? ie using BeginTransaction/EndTransaction – Rory Feb 18 '10 at 22:35