In my Visual Studio 2008 ASP.NET codebehind webpage, I invoke the procedure for adding SQL tables to a table as follows.
NewLabID = LabItem.AddLaborItem(ThisWONum, TechID, DateTime.Now, DateTime.Now, "Working", "");
The record is added correctly, but "NewLabID" returns 1 each time, and not a new new LabID (LabID is defined as int / identity). Auto Generated Code Insert Command
INSERT INTO [LaborDetail] ([WONum], [TechID], [StartDate], [StopDate], [OtherType], [OtherDesc]) VALUES (@WONum, @TechID, @StartDate, @StopDate, @OtherType, @OtherDesc); SELECT LabID FROM LaborDetail WHERE (LabID = SCOPE_IDENTITY())
and auto-generated code that calls this:
returnValue = command.ExecuteNonQuery();
When doing this with the debugger, returnValue is always 1. Should the above command return the new value of the identification field?
source share