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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top