PrepAway - Latest Free Exam Questions & Answers

Category: 70-516

Exam 70-516: TS: Accessing Data with Microsoft .NET Framework 4

What should you do in the ADO.NET Entity Framework Designer?

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. The model contains an entity type named Product.

You need to ensure that a stored procedure will be invoked when the ObjectContext.SaveChanges method is executed after an attached Product has changed.
What should you do in the ADO.NET Entity Framework Designer?

Which code segment should you insert at line 08?

You use Microsoft .NET Framework 4.0 to develop an application that connects to a Microsoft SQL Server 2008 database.
You add the following table to the database.

CREATE TABLE Orders(
ID numeric(18, 0) NOT NULL,
OrderName varchar(50) NULL,
OrderTime time(7) NULL,
OrderDate date NULL)

You write the following code to retrieve data from the OrderTime column. (Line numbers are included for reference only.)

01 SqlConnection conn = new SqlConnection(“”);
02 conn.Open();
03 SqlCommand cmd = new SqlCommand(“SELECT ID, OrderTime FROM Orders”, conn);
04 SqlDataReader rdr = cmd.ExecuteReader();
05 ….
06 while(rdr.Read())
07 {
08 ….
09 }

You need to retrieve the OrderTime data from the database. Which code segment should you insert at line 08?

Which line of code should you insert at line 21?

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?

Which code segment should you use?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application that uses the Entity Framework.
The application has an entity model that contains a SalesOrderHeader entity. The entity includes an OrderDate property of type DateTime.
You need to retrieve the 10 oldest SalesOrderHeaders according to the OrderDate property.
Which code segment should you use?

What should you do?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application that connects to a database by using the Entity Framework.
You create an Entity Data Model (EDM) by using the Generate from database wizard for the following tables.

You need to ensure that the EDM contains an entity type named Employee that contains all of the data from both tables.
What should you do?

Which code segment should you insert at line 08?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application that uses LINQ to SQL.
The application contains the following model. You write the following code. (Line numbers are included for reference only.)

01 static void Insert()
02 {
03 NorthwindDataContext dc = new NorthwindDataContext();
04 Customer newCustomer = new Customer();
05 newCustomer.Firstname = Todd;
06 newCustomer.Lastname = Meadows;
07 newCustomer.Email = troeadows@contoso.com;
08 …..
09 dc.SubmitChanges();
10 }

A product named Bike Tire exists in the Products table. The new customer orders the Bike Tire product.
You need to ensure that the correct product is added to the order and that the order is associated with the new customer.
Which code segment should you insert at line 08?

Which code segment should you insert at line 04?

You use Microsoft .NET Framework 4.0 to develop an application that connects to a Microsoft SQL Server 200B database.
You populate a SqlDataAdapter by using the following code. (Line numbers are included for reference only.)

01 SqlDataAdapter dataAdapter1 = new SqlDataAdapter(“SELECT * FROM [BlogEntries] ORDER BY CreationDate, connection);
02 cmdBuilder = new SqlCommandBuilder(dataAdapter1);
03 dataAdapter1.Fill(BlogEntryDataSet, BlogEntries);
04 ….
05 connection.Close();

You need to update the blog owner for all BlogEntry records. Which code segment should you insert at line 04?

Which code segment should you use?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application that uses LINQ to SQL.
The application contains the following model.

Each region contains a single vendor. Customers order parts from the vendor that is located in their region.
You need to ensure that each row in the Customer table references the appropriate row from the Vendor table.
Which code segment should you use?


Page 3 of 1912345...10...Last »