It seems like this should be easy, but it has proven to be quite
painful.
I have an existing dataset, which I used the GetChanges and WriteXML
functions upon to write out a DiffGram to a local XML file. I want to
use this same dataset (in another instance of the application) and the
DiffGram to display the changes in the DataGridView as they existed
after the user made his/her change.
In English:
A user will open the application, which displays data in a grid, make
their changes and hit save. This will save only the changes (in a
diffgram) to a local file. They will then come in the next day and
make a few more changes. I would like the application to grab the
original data and merge their previous changes into the original data
and display that on the grid.
I've used both ReadXML as well as Merge, but ReadXML only appends the
rows in the DiffGram to the end, and Merge doesn't seem to do anything
but toss the DiffGram square into the garbage.
Here is my code:
Dim dsList As New DataSet
Dim dsChanges As New DataSet
mySqlDataAdapter.AcceptChangesDuringFill = False
mySqlDataAdapter.Fill(dsList)
If File.Exists(strChanges) AndAlso
File.ReadAllText(strChanges).Length 0 Then
' ReadXml on the original dataset just adds it to the
end
'dsList.ReadXml(strChanges, XmlReadMode.DiffGram)
'.Tables(0).
dsChanges.ReadXml(strChanges, XmlReadMode.DiffGram)
dsList.Merge(dsChanges, True)
End If
grdResults.DataSource = dsList.Tables(0)
Please help!