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 / XML / March 2007

Tip: Looking for answers? Try searching our database.

Dataset Merge / getchanges just adding records?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bmack500 - 28 Mar 2007 14:57 GMT
I'm using the following subroutine. The two different XML files are
identical with the exception of three additional records in the second
one. One has 450 records, and the other has 453. After merging, I get
903 records. I guess what I expected was 3 records; just the
differences in the two.
The two tables have the exact same structure, etc....

So am I misinterpreting how to do this? It seems to me that the merge
should produce only three new records!

Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnStart.Click
       Dim dsOld As DataSet = New DataSet
       Dim dsCurr As DataSet = New DataSet
       Dim dsTemp As DataSet = New DataSet
       Dim dsChanges As DataSet = New DataSet
       dsTemp.DataSetName = "SERVERINFO"
       dsChanges.DataSetName = "SERVERINFO"

       dsOld.ReadXml("c:\dsOld.xml", XmlReadMode.ReadSchema)

       dsCurr.ReadXml("c:\dsCurr.xml", XmlReadMode.ReadSchema)

       dsTemp.Merge(dsOld)
       dsTemp.AcceptChanges()
       dsTemp.Merge(dsCurr)

       dsTemp.WriteXml("c:\dsTemp.xml", XmlWriteMode.DiffGram)

       dsChanges = dsTemp.GetChanges()

       dsChanges.WriteXml("c:\dsChanges.xml", XmlWriteMode.DiffGram)

       Debugger.Break()
   End Sub
Latish Sehgal - 29 Mar 2007 18:37 GMT
The merge function is used to merge in new changes.
Check out http://msdn2.microsoft.com/en-us/library/06t089d7.aspx
Maybe you can try changing the DataRowState of the 2nd dataset before
merging.
Hope this helps.

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.