Please, How can I get the value of the identity field of the register that I was including in the data base. I am using a stored procedure in SQLSERVER in a asp .net application and I need to show that for the user, it′s like the number of the reclamation.In your stored proc, create an OUTPUT parameter. return the identity value through the OUTPUT parameter. Here's a sample:
CREATE PROC dbo.usp_Somestoredproc (
@.someparam1 int
,@.someparam2 varchar(50)
,@.retval int OUTPUT
)
AS
BEGIN
SET NOCOUNT ON
INSERT INTO yourTable
(somecol1,somecol2)
VALUES (@.someparam1, @.someparam2)
SELECT @.retval=SCOPE_IDENTITY()
SET NOCOUNT OFF
END
From your ASP.NET Code you can catch the value returned by declaring an output parameter.
|||Hi,
thanks. I've tested and it returned the value of the identitiy.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment