cjard
Well-known member
- Joined
- Apr 25, 2006
- Messages
- 7,081
- Programming Experience
- 10+
Microsoft advocate using transaction server with a block of code like this:
This is occasionally quite slow, though I think it MAY have the advantage of rolling back any client side changes if the transaction fails (i.e. you get 50% through your inserts then they fail, it might revert all your rows that up to now have been AcceptChanges()d so that they can participate again)
Does anyone else perform database transactions other ways?
TableAdapters, ingeniously designed as they are, actually do not fiddle with the state of a connection if it is already open when they come to use it. THis means we can open our first conenction manually, and start a transaction on it, then pass that connection and also transaction to every other tableadapter we wish to use in the same transaction. Does anyone do this? How did it work out for you?
VB.NET:
Using ts as New System.Transactions.TransactionScope()
... multiple tableadapter calls to update
End Using
This is occasionally quite slow, though I think it MAY have the advantage of rolling back any client side changes if the transaction fails (i.e. you get 50% through your inserts then they fail, it might revert all your rows that up to now have been AcceptChanges()d so that they can participate again)
Does anyone else perform database transactions other ways?
TableAdapters, ingeniously designed as they are, actually do not fiddle with the state of a connection if it is already open when they come to use it. THis means we can open our first conenction manually, and start a transaction on it, then pass that connection and also transaction to every other tableadapter we wish to use in the same transaction. Does anyone do this? How did it work out for you?