This question is locked. New answers and comments are not allowed.
I have a stored procedure for inserting new record, like that:
In my project, if I use:
How can I get the identity that is returned by this stored procedure?
Please help me in this case. Thanks!
CREATE
PROCEDURE
[dbo].[sp_InsertRecord]
(
@FirstName NVARCHAR(50) ,
@LastName NVARCHAR(50) ,
@Title NVARCHAR(50) ,
@ContactID
INT
OUTPUT
)
AS
BEGIN
SET
NOCOUNT
ON
;
INSERT
INTO
dbo.Contacts
VALUES
( @FirstName, @LastName, @Title )
SET
@ContactID = SCOPE_IDENTITY()
RETURN
@ContactID
END
GO
In my project, if I use:
dbContext.Sp_InsertRecord(contact.FirstName, contact.LastName, contact.Title, 1)
How can I get the identity that is returned by this stored procedure?
Please help me in this case. Thanks!