dataadapter autoincrement challenge

  • Thread starter Thread starter Derek Chong
  • Start date Start date
D

Derek Chong

Hi all,

When I call the dataadapter.Update(datatable) function, the Id column of the
datatable does not get updated with the value generated by Identity colum on
the related database table for new rows.

Is this by design? If so, is there an 'easy' way to update the new row Id
values?

Setting AutoIncrementStep = -1 resolves any conflict with existing Ids but I
still don't get the new Id.

I know you can use Select @@ Identity to manually update the Id but this
doesn't work when the datatable contains multiple new rows unless you loop
through each new row and update one at a time :-(

Seems like something the dataadapter should handle?

Derek
 
The idea was to reduce the size/weight/overhead of ADO.NET so you have an
opportunity to handle these issues yourself. They found that generic
"one-size-fits-all" solutions worked but not for all cases and were far less
efficient than focused solutions. It's not that tough to implement.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Back
Top