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 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.
Sub New(customerID As Guid, customerName As [String], address1 As [String])
End Sub
The application contains the following the following code segment. (Line numbers are included for
reference only.)
01 Dim context As New CustomDataContext()
02 Dim userID As Guid = Guid.NewGuid()
03 Dim address1 As [String] = “1 Main Street”
04 Dim name As [String] = “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, name , address1)

B.
context.ExecuteCommand(“createCustomer”, userID, name , address1)

C.
Dim customer As New Customer()
context.ExecuteCommand(“createCustomer”, customer)

D.
Dim customer As New Customer()
context.ExecuteQuery(GetType(Customer), “createCustomer”, customer)

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


Leave a Reply