Typed dataset INSERT command return value: data row or boolean result of insertion?
This is an extension of a previously answered question. I thought I had the solution, but got sidetracked on return values.
I am trying to get the value of the unique identifier(autogenerated) for newly inserted rows so that I can update memory-resident collections to reflect the newly inserted identity value.
I am using typed datasets and I set up an insert command that contains code to return the newly inserted row via SCOPE IDENTITY. (See code window)
The problem I am having is that the command seems to be returning a numeric value, indicating the success of the operation, and not a row containing the field values I need.
If this does return a row, where can it be referenced?
IF EXISTS (SELECT * FROM sysobjects WHERE name = 'TestTableInsertQuery' AND user_name(uid) = 'dbo') DROP PROCEDURE dbo.TestTableInsertQueryGOCREATE PROCEDURE dbo.TestTableInsertQuery( @PatID int, @Comments text)AS SET NOCOUNT OFF;INSERT INTO TestTable (PatID, Comments)VALUES (@PatID,@Comments);SELECT UniqueID, PatID, Comments FROM TestTable WHERE (UniqueID = SCOPE_IDENTITY())GO