Here's my stored procedure
ALTER PROCEDURE dbo.spInsertNewTask
@ModuleID int,
@Task varchar(50),
@StartDate date,
@PlannedEndDate date,
@EstimatedEndDate date,
@Status int,
@Comments varchar(500),
@Started bit
AS
INSERT INTO DTasks (ModuleID, Task, StartDate, PlannedEndDate, EstimatedEndDate, Status, Comments, Started, LastUpdated)
VALUES (@ModuleID, @Task, @StartDate, @PlannedEndDate, @EstimatedEndDate, @Status, @Comments, @Started, GETDATE())
RETURN SCOPE_IDENTITY()
When I try to capture the newly created ID, all I'm getting is always 1. How to capture the New row's ID?
newID = cmd.ExecuteNonQuery();
In fact I need this new ID for further processing.
Thanks for helping.