Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / May 2007

Tip: Looking for answers? Try searching our database.

DataTable.Merge()

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mj2736@yahoo.com - 02 May 2007 20:46 GMT
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.
Peter Bromberg [C# MVP] - 02 May 2007 21:09 GMT
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
Signature

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

> I'm a little confused about DataTable.Merge(). I have two DataTable
> objects with the same structure - dtOrig and dtCurrent. The end result
[quoted text clipped - 8 lines]
> NOT actually updated! What am I missing here? Is there a better way to
> go about this? Thanks.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.