Groups | Blog | Home
all groups > dotnet ado.net > september 2007 >

dotnet ado.net : Transactions




9/30/2007 12:52:00 PM
Transactions with .NET 2.0.

If I code this in C# method:


Customer objCust = new Customer();

using(TransactionScope scope=new TransactionScope())
{

objCust.UpdateData(); // updates customer record via stored
procedure with a standard excutenonquery
scope.Complete();

}

Is it necessary to then put in the SQL Server Stored Procedure SQL a
Begin Transaction/End Transaction syntax, or is this already taken
care of with the above code?
Miha Markic
10/1/2007 12:00:00 AM
If your dataprovider (I assume SQL Server in this case) supports
System.Transactions (Sql Server ado.net provider does) then you don't need
explicit begin/end transaction syntax as those are taken care by
TransactionScope.

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

[quoted text, click to view]
AddThis Social Bookmark Button