You are debugging an issue with an application that uses nested transactions. You notice that the following code executes without throwing an exception:

using (TransactionScope scope = new TransactionScope())
using (SqlConnection connection1 = new SqlConnection(connectString1))
SqlCommand command1 = new SqlCommand(updateCommandText, connection1);
using (SqlConnection connection2 = new SqlConnection(connectString2))
SqlCommand command2 = new SqlCommand(insertCommandText, connection2);

However, you notice that the database changes are not persisted. You must ensure that when Complete is called, changes are persisted.

What should you do?

 Posted by Rajkatie on 9/30/2012 | Category: ADO.NET Interview questions | Views: 2342 | Points: 40
Select from following answers:
  1. Set the TransactionScopeOption to RequiresNew.
  2. Set the TransactionScopeOption to Required.
  3. Add the Enlist=true setting to the connection strings.
  4. All Above

Show Correct Answer

Source: MeasureUp.Com | | Alert Moderator 

Comments or Responses

Login to post response