nerdexam
Microsoft

70-516 · Question #245

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 D. Dim cmd As SqlCommand = New SqlCommand ("InsertTag", conn). See the full explanation below for the reasoning.

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 dtao.InsertTag BName nvarchar (15) AS INSERT INTO Tags (Name) VALUES(@Name) RETURN @@ROWCOUNT You need to invoke the stored procedure by using an open SqlConnection named conn. Which code segment should you use?

Options

  • ADim cmd As SqlCommand =new SqlCommand("EXEC InsertTag", conn)
  • BDim cmd As SqlCommand =new SqlCommand("EXEC InsertTag", conn)
  • CDim cmd As SqlCommand = New SqlCommand("InsertTag", conn)
  • DDim cmd As SqlCommand = New SqlCommand ("InsertTag", conn)

How the community answered

(52 responses)
  • A
    4% (2)
  • B
    12% (6)
  • C
    6% (3)
  • D
    79% (41)

Community Discussion

No community discussion yet for this question.

Full 70-516 Practice