You use a SqlCommand command to execute the following stored procedure:

CREATE PROCEDURE dbo.InsertCustomer
(
@companyName NVARCHAR(40),
@contactName NVARCHAR(30)
)
AS
INSERT INTO dbo.Customers (CompanyName, ContactName)
VALUES (@companyName, @contactName)
RETURN @@IDENTITY

You must retrieve the return value of the stored procedure.

What should you do?

 Posted by Rajkatie on 9/4/2012 | Category: ADO.NET Interview questions | Views: 2912 | Points: 40
Select from following answers:
  1. Add a parameter named @@RETURN_VALUE with Direction ParameterDirection.ReturnValue. Retrieve its value after executing the command.
  2. Execute the query using SqlCommand.ExecuteNonQuery and retrieve this method's return value.
  3. Add a parameter named @@IDENTITY with Direction ParameterDirection.Output. Retrieve its value after executing the command.
  4. All Above

Show Correct Answer


Source: MeasureUp.Com | | Alert Moderator 

Comments or Responses

Login to post response