Author: you've been HAACKED | Posted on: 8/19/2009 10:18:45 AM | Views : 689

The .NET Framework provides support for managing transactions from code via the System.Transactions infrastructure. Performing database operations in a transaction is as easy as writing a using block with the TransactionScope class. using (TransactionScope transaction = new TransactionScope()) { DoSomeWork(); SaveWorkToDatabase(); transaction.Complete(); } At the end of the using block, Dispose is called on the transaction scope. If the transaction has not been completed (in other words, transaction.Complete was not called), then the transaction is rolled back. Otherwise it is committed to the underlying data store. The typical reason a transaction might not be completed is that an exception is thrown within the using block and thus the Complete...(read more) ...

Go to the complete details ...