IDENTITY vs SCOPE_IDENTITY() vs IDENT_CURRENT
The insert satement should look something like this.
INSERT INTO TABLE (COLUMN1, COLUMN2, ...)
VALUES (@COLUMN1,@COLUMN2, ...);
SELECT IDENTITY_COLUMN FROM TABLE WHERE (IDENTITY_COLUMN = SCOPE_IDENTITY())
Then in your code do something like this
int identity = Convert.ToInt32(TableAdapter.InsertMethod(value1, value2, value3));
No comments:
Post a Comment