DataSet - Forcing Values in IDENTITY fields

  • Thread starter Thread starter Kashish
  • Start date Start date
K

Kashish

There are numerous posts and articles on retrieving the IDENTITY
values after inserts from Dataset.

However, is there a way to force a value of an identity column through
Dataset? The objective is to retrieve bulk rows from a source database
and insert into a target database keeping the values of Identity
columns intact.

Thanks in advance!
 
If I understand the problem correctly, I think you may want to consider
dropping the identinty for the insert and just using the scalar values just
as though they were any other literal . You could still use the key to
enforce integrity if you want so you could ultimately get to the same place.
I'm not sure where you are looking to do the assignment, but if you are
looking to do it client side then you could simply set the Autoincrement
Property of the Key dataColumn to true, then set its AutoIncrementSeed and
value properties respecitvely.

With that said, If at all possible you may want to skip ADO.NET altogether
and opt for DTS or BulkCopy since they are better suited for this type of
task. Ultimately it would depend on the number of rows and similar factors,
but in general, disconnected dataset methodology isn't really a great fit
here ----- At least until ADO.NET 2.0
http://www.knowdotnet.com/articles/bulkcopy_intro1.html
http://msmvps.com/williamryan/archive/2004/07/10/9890.aspx which has the
most kick a33 solution i've come across in a while.

--
W.G. Ryan MVP Windows - Embedded

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/community/newsgroups
 
Back
Top