239.

You use a TransactionScope in your application in your application in order to use transaction semantics. What code should you use in order to commit the transaction within the transaction scope?

public void Transfer(double amount) 

      using(TransactionScope ts = new TransactionScope()) 
      { 
            using(DbConnection connection = new SqlConnection("connectionString")) 
            { 
                  Withdraw(connection, amount); 
                  Deposit(connection, amount); 
                  ts.Complete(); 
            } 
      } 

public void Withdraw(DbConnection connection, double amount) 
{ // Withdraw logic } 

public void Deposit(DbConnection connection, double amount) 
{ // Deposit logic }

ts.Complete Method Indicates that all operations within the scope are completed successfully.