70-516 · Question #276
You use Microsoft .NET Framework 4 to develop an application that connects to a Microsoft SQL Server 2008 database. You add the following stored procedure to the database. CREATE PROCEDURE…
The correct answer is A. Dim res = command.ExecuteReader(). ExecuteReader Sends the CommandText to the Connection and builds a SqlDataReader. SqlCommand Class
Question
You use Microsoft .NET Framework 4 to develop an application that connects to a Microsoft SQL Server 2008 database. You add the following stored procedure to the database. CREATE PROCEDURE GetSalesPeople AS BEGIN SELECT FirstName, LastName, Suffix, Email, Phone FROM SalesPeople END You write the following code. (Line numbers are included for reference only.) 01Dim connection As SqlConnection = New SqlConnection("& ") 02Dim command As SqlCommand = New SqlCommand("GetSalesPeople", connection) 03command.CommandType = CommandType.StoredProcedure You need to retrieve all of the results from the stored procedure. Which code segment should you insert at line 04
Options
- ADim res = command.ExecuteReader()
- BDim res = command.ExecuteScalar()
- CDim res = command.ExecuteNonQuery()
- DDim res = command.ExecuteXmlReader()
How the community answered
(58 responses)- A84% (49)
- B9% (5)
- C5% (3)
- D2% (1)
Explanation
ExecuteReader Sends the CommandText to the Connection and builds a SqlDataReader. SqlCommand Class
Topics
Community Discussion
No community discussion yet for this question.