Transactions

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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.
 
Back
Top