transactions

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

Assume you've created a connection to SQL Server using the SqlConnection
class. You execute two stored procedures. Can you use the BeginTransaction
and RollBack method of the connection object to rollback the results of the
stored procedures if one of the two bombs?

I understand you can do this with raw SQL, but wanted to confirm you could
also do it with stored procedures. Thanks in advance.

Mark
 
Mark,

You could do it if you call BeginTransaction before you make the call to
the two stored procedures. The transaction is a connection level
attribute/property, if you will, and you need to make sure it is
instantiated before you do anything else on that connection (which you want
to take part in that transaction).

Hope this helps.
 
Back
Top