Blog Home  Home Feed your aggregator (RSS 2.0)  
Software Code Help - What is the Savepoints in Transaction in ADO.NET.
Blog
 
# Friday, July 03, 2009

When we roll back our transaction, it nullifies the effect of every command you’ve executed since you started the last transaction. But what happens if you want to roll back only part of an ongoing transaction? SQL Server handles this with a feature called savepoints.

Savepoints are markers that act like bookmarks. You mark a certain point in the flow of the transaction, and then you can roll back to that point. You set the savepoint using the Transaction.Save() method.

Here’s a conceptual look at how you use a savepoint:

// Start the transaction.
SqlTransaction trans = Connection.BeginTransaction();
// Mark a savepoint.
trans.Save("CompletedUpdate");
// If needed, roll back to the savepoint.
trans.Rollback("CompletedUpdate");
// Commit or roll back the transaction.
trans.Commit();
Friday, July 03, 2009 12:35:56 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   Interview Question ADO.NET  | 
Comments are closed.
Copyright © 2010 SoftwareCodeHelp. All rights reserved.
DasBlog 'Portal' theme by Johnny Hughes.
Pick a theme: