nerdexam
Microsoft

70-516 · Question #109

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. SqlCommand cmd = 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 [dbo].[InsertTag] @Name nvarchar (15) AS INSERT INTO [dbo].[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

  • ASqlCommand cmd = new SqlCommand("EXEC InsertTag", conn);
  • BSqlCommand cmd = new SqlCommand("EXEC InsertTag", conn);
  • CSqlCommand cmd = new SqlCommand("InsertTag", conn);
  • DSqlCommand cmd = new SqlCommand("InsertTag", conn);

How the community answered

(24 responses)
  • A
    17% (4)
  • B
    4% (1)
  • C
    4% (1)
  • D
    75% (18)

Community Discussion

No community discussion yet for this question.

Full 70-516 Practice