HighTechTalks DotNet Forums  

partial merge?

Dotnet Framework (ADO.net) microsoft.public.dotnet.framework.adonet


Discuss partial merge? in the Dotnet Framework (ADO.net) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
eran
 
Posts: n/a

Default partial merge? - 05-12-2007 , 02:19 PM






Hi,
I'm using DataTable.Merge() to merge values from a source DT into a
destination DT which are in seperate Datasets.
The source DT has columns A,B,C and the destination DT has columns A,B,D.
column A is primary key for both of them. So, basically, my target is to
copy all the values from column B in the source DT to column B in the
destination DT. So far so good (Merge with MissingSchemaAction.Ignore does
the job).
However, The source DT has 1000 rows and the destination DT has 50 rows. The
Merge action copy all the 1000 rows into the destination DT, where I'm only
interested in updating the existing 50 rows in the destination DT. (Just
update, no Insert). From what I've read, if merge doesn't find a
corresponding PK it adds the new rows.
Is there any way to go around this with merge? any other way, without using
merge? (I tried to save looping over all the rows in one DT and locating them
in the other one)

Thanks in advance
Eran


Reply With Quote
  #2  
Old   
Manish Bafna
 
Posts: n/a

Default RE: partial merge? - 05-14-2007 , 10:43 AM






Hi,
try merge with MissingSchemaAction.AddWithKey
Hope this helps
--
Thanks and Regards.
Manish Bafna.
MCP and MCTS.



"eran" wrote:

Quote:
Hi,
I'm using DataTable.Merge() to merge values from a source DT into a
destination DT which are in seperate Datasets.
The source DT has columns A,B,C and the destination DT has columns A,B,D.
column A is primary key for both of them. So, basically, my target is to
copy all the values from column B in the source DT to column B in the
destination DT. So far so good (Merge with MissingSchemaAction.Ignore does
the job).
However, The source DT has 1000 rows and the destination DT has 50 rows. The
Merge action copy all the 1000 rows into the destination DT, where I'm only
interested in updating the existing 50 rows in the destination DT. (Just
update, no Insert). From what I've read, if merge doesn't find a
corresponding PK it adds the new rows.
Is there any way to go around this with merge? any other way, without using
merge? (I tried to save looping over all the rows in one DT and locating them
in the other one)

Thanks in advance
Eran


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.