Transactionscope不在Subsonic中使用SQLite

时间:2009-07-24 06:48:36

标签: vb.net subsonic

我在SQLite上使用transactionscope时遇到问题,我正在使用以下代码。当我不调用ts.Complete()函数时,更改仍会提交到数据库。

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 个答案:

答案 0 :(得分:0)

如果我没记错的话,你需要在那里的某个地方调用BeginTransaction和EndTransaction来告诉SQLite你正在进入并随后离开一个事务块 - 如果我没记错的话,包装一个(使用事务作为IDbCommand) .BeginTransaction())围绕任何基于事务的代码是必要的(虽然我有一段时间没有做过ADO.NET。)