Your Microsoft SQL Server database includes the following stored procedure:

CREATE PROCEDURE dbo.DeleteExpiredAnnotations
AS

DELETE FROM Annotations WHERE Date < DATEADD(month, -6, GETDATE())

GO

You must add code to use a SqlConnection named connection to call this stored procedure and get the number of rows deleted.

Which code segment should you use?

 Posted by Rajkatie on 9/5/2012 | Category: ADO.NET Interview questions | Views: 2816 | Points: 40
Select from following answers:
  1. SqlCommand command = new SqlCommand("DeleteExpiredAnnotations ", connection); command.CommandType = CommandType.StoredProcedure; command.Connection.Open(); int count = (int)command.ExecuteScalar();
  2. SqlCommand command = new SqlCommand("DeleteExpiredAnnotations ", connection); command.CommandType = CommandType.StoredProcedure; command.Connection.Open(); int count = command.ExecuteNonQuery();
  3. SqlCommand command = new SqlCommand("DeleteExpiredAnnotations ", connection); command.CommandType = CommandType.StoredProcedure; command.Connection.Open(); command.ExecuteNonQuery(); int count = (int)command.Parameters["@ReturnValue"].Value;
  4. All Above

Show Correct Answer


Source: MeasureUp.Com | | Alert Moderator 

Comments or Responses

Login to post response