Save [SQL Server only]
void = Transaction.Save(String savePointName
);
Creates a savepoint in the transaction that can roll back a portion of the transaction.
The following example demonstrates how to create and use a savepoint to partially roll back a transaction:
String connString = "Data Source=(local);Integrated security=SSPI;" + "Initial Catalog=Northwind;"; SqlConnection conn = new SqlConnection(connString); conn.Open(); SqlTransaction tran = conn.BeginTransaction(); try { // ... execute some commands against the data source } catch (Exception ex) { // roll back the transaction, close the connection, and leave tran.Rollback(); conn.Close(); return; } // create a save point called SavePoint1 tran.Save("SavePoint1"); try { // ... execute some commands against the data source tran.Commit(); } catch (SqlException ex) { // roll back the transaction to the save point tran.Rollback("SavePoint1"); // commit all processing up to the save point tran.Commit(); } finally { conn.Close(); }