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

Re: dataadapter autoincrement challenge by William

William
Mon Nov 10 23:42:42 CST 2003

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnadonet/html/manidcrisis.asp
"Derek Chong" <dchong@landfood.unimelb.edu.au> wrote in message
news:eGd8rWBqDHA.2808@TK2MSFTNGP10.phx.gbl...
> 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
>
>
>



Re: dataadapter autoincrement challenge by Derek

Derek
Tue Nov 11 00:00:10 CST 2003

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

Thanks for the heads up
Derek

"William Ryan" <dotnetguru@nospam.comcast.net> wrote in message
news:Oy7yWaBqDHA.2536@tk2msftngp13.phx.gbl...
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnadonet/html/manidcrisis.asp
> "Derek Chong" <dchong@landfood.unimelb.edu.au> wrote in message
> news:eGd8rWBqDHA.2808@TK2MSFTNGP10.phx.gbl...
> > 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
> >
> >
> >
>
>



Re: dataadapter autoincrement challenge by William

William
Tue Nov 11 11:26:43 CST 2003

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

"Derek Chong" <dchong@landfood.unimelb.edu.au> wrote in message
news:O3jw$jBqDHA.2772@TK2MSFTNGP10.phx.gbl...
> Ouch!!! Could they have made it any more complex.
>
> Thanks for the heads up
> Derek
>
> "William Ryan" <dotnetguru@nospam.comcast.net> wrote in message
> news:Oy7yWaBqDHA.2536@tk2msftngp13.phx.gbl...
> >
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnadonet/html/manidcrisis.asp
> > "Derek Chong" <dchong@landfood.unimelb.edu.au> wrote in message
> > news:eGd8rWBqDHA.2808@TK2MSFTNGP10.phx.gbl...
> > > 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
> > >
> > >
> > >
> >
> >
>
>