PC Review


Reply
Thread Tools Rate Thread

DataTable.Merge()

 
 
mj2736@yahoo.com
Guest
Posts: n/a
 
      2nd May 2007
I'm a little confused about DataTable.Merge(). I have two DataTable
objects with the same structure - dtOrig and dtCurrent. The end result
I'm trying to achieve is to get all the rows in dtCurrent that are in
some way different from the corresponding rows in dtOrig so those new/
modified/deleted rows can be processed. My idea was to use
dtOrig.Merge(dtCurrent), and then call dtOrig.GetChanges(). But what I
found is that when the preserveChanges Merge() parameter is
'false' (or not supplied) the values in dtOrig do get updated, but the
RowState stays 'Unchanged'. When preserveChanges is 'true' then the
RowState for all rows becomes 'Modified' but the values in dtOrig are
NOT actually updated! What am I missing here? Is there a better way to
go about this? Thanks.

 
Reply With Quote
 
 
 
 
=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
Guest
Posts: n/a
 
      2nd May 2007
Depending on "how" you got to your dtOrig and dtCurrent Datatables, the Merge
method may not give you the behavior you are looking for. This page of the
documentation should help clear things up:

http://msdn2.microsoft.com/en-us/library/fk68ew7b.aspx

sorry if dupe, MS' web thang not cooperating today.

Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net




"(E-Mail Removed)" wrote:

> I'm a little confused about DataTable.Merge(). I have two DataTable
> objects with the same structure - dtOrig and dtCurrent. The end result
> I'm trying to achieve is to get all the rows in dtCurrent that are in
> some way different from the corresponding rows in dtOrig so those new/
> modified/deleted rows can be processed. My idea was to use
> dtOrig.Merge(dtCurrent), and then call dtOrig.GetChanges(). But what I
> found is that when the preserveChanges Merge() parameter is
> 'false' (or not supplied) the values in dtOrig do get updated, but the
> RowState stays 'Unchanged'. When preserveChanges is 'true' then the
> RowState for all rows becomes 'Modified' but the values in dtOrig are
> NOT actually updated! What am I missing here? Is there a better way to
> go about this? Thanks.
>
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
need again help with DataTable Merge Frank Uray Microsoft C# .NET 5 8th Feb 2009 04:14 PM
DataTable.Merge() mj2736@yahoo.com Microsoft Dot NET Framework 1 2nd May 2007 09:09 PM
DataTable.Merge() mj2736@yahoo.com Microsoft ADO .NET 1 2nd May 2007 09:09 PM
Help with DATATABLE and DS MERGE John Cosmas Microsoft Dot NET Framework Forms 0 1st Oct 2005 03:32 PM
Merge DataTable Rows into Second DataTable =?Utf-8?B?TWF0dCBO?= Microsoft ADO .NET 2 12th Apr 2005 04:42 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:19 PM.