Please help me editing following SQL Server stored procedure to get the ID
of last inserted row using an OUTPUT
statement so that retrieve it throw C# code behind like
int ID = Convert.ToInt32(insertUser.ExecuteScalar());
Stored procedure code:
AS
BEGIN
SET NOCOUNT ON;
DECLARE @ID INT
INSERT INTO dbo.Registration_Table (StudentName, Email, CourseCode, CourseTitle)
VALUES (@StudentName, @Email, @CourseCode, @CourseTitle)
SELECT 2
END
GO