Friday, November 26, 2010

Transaction Handling in C#

using System.Transactions;
Transaction on C# When handling only one Stored Procedure

using (TransactionScope transaction = new TransactionScope())
{
-- Write your code here it rolback if there is any issue in your query.

transaction.Complete();
}

Some time we need to update multiple table using multiple methods
at that time use

using (TransactionScope TranScope = new TransactionScope())
{
//Write your code here

TranScope.Complete();
}

No comments:

Post a Comment