views:

269

answers:

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
A: 

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).

B.R.
No, not necessary if you're using a TransactionScope like this.
David M
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
most probably it is SQLite ADO.net Provider
TheVillageIdiot
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.
B.R.
Could you post the code you ended up using as the solution? ie using BeginTransaction/EndTransaction
Rory
A: 

See this question for a suggested approach for transactions when using SubSonic and sqlite:

http://stackoverflow.com/questions/2291364/locking-problems-with-sqlite-and-subsonic-when-using-transactions-on-a-single-thr

Rory