PrepAway - Latest Free Exam Questions & Answers

Which code segment should you insert at line 05?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
The application connects to a Microsoft SQL Server database and contains a LINQ to SQL data model.
The data model contains a function named createCustomer that calls a stored procedure.
The stored procedure is also named createCustomer. The createCustomer function has the following signature.

createCustomer (Guid customerID, String customerName, String address1)

The application contains the following code segment. (Line numbers are included for reference only.)

01 CustomDataContext context = new CustomDataContext();
02 Guid userID = Guid.NewGuid();
03 String address1 = “1 Main Steet”;
04 String name = “Marc”;
05 …

You need to use the createCustomer stored procedure to add a customer to the database.
Which code segment should you insert at line 05?

PrepAway - Latest Free Exam Questions & Answers

A.
context.createCustomer(userID, customer1, address1);

B.
context.ExecuteCommand(“createCustomer”, userID, customer1, address1);
Customer customer = new Customer() { ID = userID, Address1 = address1, Name = customer1, };

C.
context.ExecuteCommand(“createCustomer”, customer);
Customer customer = new Customer() { ID = userID, Address1 = address1, Name = customer1, };

D.
context.ExecuteQuery(typeof(Customer), “createCustomer”, customer);

Explanation:
CHAPTER 4 LINQ to SQL
Lesson 3: Submitting Changes to the Database
Using Stored Procedures (page 285)

2 Comments on “Which code segment should you insert at line 05?


Leave a Reply