Hmm .. @@IDENTITY?
That is assuming I understood your question correctly LOL.
The last generated key in a SQL Server can be found by calling "Select
@@IDENTITY"
However here is another idea that you might find useful -
Once you fill your dataset, you could set the seed and increment of your
dataset to -1, so there are never any collisions when you finally go
inserting new rows. So in the method in which you finally update the
database, you could then refill your dataset replacing the -1's with the
actual keys that the SQL Server generated. I can't wait till Yukon where my
stored proc. will accept a dataset rather than me trying to mangle it to a
REF CURSOR or equivalent.
Wish I knew more to answer you better
, but hope this helps.
- Sahil Malik
Independent Consultant
You can reach me thru my blog -
http://dotnetjunkies.com/WebLog/sahilmalik/
Gary said:
I am using the update method of a dataadapter to insert a record into a
table in SQL Server from a VB .Net procedure. The data adapter is calling a
stored procedure. In the stored procedure I would like to run a select to
verify that the record does not already exist in the table, since the key
field is an autoincremented key. How do I pass back the return code from the
select in the SQL Server stored procedure to my VB .Net procedure? Thanks.