Online Access Free 070-516 Practice Test
| Exam Code: | 070-516 |
| Exam Name: | TS: Accessing Data with Microsoft .NET Framework 4 |
| Certification Provider: | Microsoft |
| Free Question Number: | 196 |
| Posted: | Oct 15, 2025 |
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?
The database contains orphaned Color records that are no longer connected to Part records.
You need to clean up the orphaned records. You have an existing ContosoEntities context object named
context.
Which code segment should you use?
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application.
You use the ADO.NET Entity Framework Designer to model entities.
You need to retrieve an entity, and you must ensure that the entity is loaded in a detached state.
Which MergeOption enumeration value should you use to retrieve the entity?
You are a tasked with performing a code review. The business rule is the following:
-If INSERTs into the first table succeed, then INSERT into the second table.
-However, if the INSERTs into the second table fail, roll back the inserts in the second table but do not roll back the inserts in the first table.
-Although this can also be done by way of regular transactions, It needs to be performed using
TransactionScope objects.
Whis code would fit this business rule?