using a DataAdapter to insert with identity column

  • Thread starter Thread starter Andy Fish
  • Start date Start date
A

Andy Fish

hi,

i am using a DataAdapter and DataSet to insert rows into a table which has
an identity column

I would expect that once I have executed the update, the field in the
corresponding DataRow would have been updated to reflect the newly allocated
id, but this does not seem to be the case.

am I missing something simple or does it simply not do this?

Andy
 
Andy:

If you're asking "Does the DataTable get automatically updated with Identity
values from the server once the insert happens"? then the answer is no. You
can search google for Bill Vaughn's Managing an @@Identity Crisis. You
basically need an output paramater or an additional query to get the
identities. If you're using the wizard, on one of the last steps, I think
youchoose Advanced and there's an option to Refresh Identify values (you
have to forgive me, I'm not a big wizard guy and my memory is a little
foggy)
 
Back
Top