Hi...
In my scenerio , i have to insert data to master table and details table . For example consider the details given below.
Function 1 : Insert data to employee master table.
Function 2 : Insert gridview data to employee details table, here employee id from employee master table is needed to pass.
I want to this using 3 tier architetcure . I can call this only in Data access layer , and if any of the functions failed both tables must not be saved ,
can any one help me on this scenerio..
Thanks and Regards
Sankar
How to use transctions or transaction Scope in ADO.NET
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Jignesh TrivediRank #16 · 50.3K pointsPosted Jul 23, 2012, 10:15 PM EDT
yes you can acheive this using transaction scope.
for same you must enable MSDTC on SQL Server.
using (TransactionScope scope = new TransactionScope())
{
...
...
...
// Complete is not called and the transaction is rolled back.
scope.Complete();
}
Please refer..
http://technet.microsoft.com/en-us/library/cc753510%28WS.10%29.aspx
http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx
hope this will help you.