dataadapter autoincrement challenge

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
 
D

Derek Chong

Ouch!!! Could they have made it any more complex.

Thanks for the heads up
Derek
 
W

William \(Bill\) Vaughn

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.
__________________________________
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top