nerdexam
Microsoft

70-516 · Question #196

70-516 Question #196: Real Exam Question with Answer & Explanation

Sign in or unlock 70-516 to reveal the answer and full explanation for question #196. The question stem and answer options stay visible for context.

Question

You use Microsoft .NET Framework 4.0 to develop an application that connects to two separate Microsoft SQL Server 2008 databases. The Customers database stores all the customer information, and the Orders database stores all the order information. The application includes the following code. (Line numbers are included for reference only.) 01 try 02 { 03 conn.Open(); 04 tran = conn.BeginTransaction("Order"); 05 SqlCommand cmd = new SqlCommand(); 06 cmd.Connection = conn; 07 cmd.Transaction = tran; 08 tran.Save("save1"); 09 cmd.CommandText = "INSERT INTO [Cust].dbo.Customer " + "(Name, PhoneNumber) VALUES ('Paul Jones', " + "'404-555-1212')"; 10 cmd.ExecuteNonQuery(); 11 tran.Save("save2"); 12 cmd.CommandText = "INSERT INTO [Orders].dbo.Order " + "(CustomerID) VALUES (1234)"; 13 cmd.ExecuteNonQuery(); 14 tran.Save("save3"); 15 cmd.CommandText = "INSERT INTO [Orders].dbo." + "OrderDetail (OrderlD, ProductNumber) VALUES" + "(5678, 'DC-6721')"; 16 cmd.ExecuteNonQuery(); 17 tran.Commit(); 18 } 19 catch (Exception ex) 20 { 21 ... 22 } You run the program, and a timeout expired error occurs at line 16. You need to ensure that the customer information is saved in the database. If an error occurs while the order is being saved, you must roll back all of the order information and save the customer information. Which line of code should you insert at line 21?

Options

  • Atran.Rollback();
  • Btran.Rollback("save2");
  • Ctran.Rollback();
  • Dtran.Rollback("save2");

Unlock 70-516 to see the answer

You've previewed enough free 70-516 questions. Unlock 70-516 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.

Full 70-516 Practice