Datasets - writing only changed records to xml file

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

Hello,

I have a dataset which i'm loading from an xml file (using ds.ReadXml() )
and I'm wondering how I can write back only the changed records to the xml
file instead of saving the whole file back to disk.

Thanks,
Paul
 
Hi,

Dim dtChanges As DataTable = ds.Tables(0).GetChanges()

Dim dsChanges As New DataSet

dsChanges.Tables.Add(dtChanges)

dsChanges.WriteXml("Changes.xml")



Ken

----------------------------

Hello,

I have a dataset which i'm loading from an xml file (using ds.ReadXml() )
and I'm wondering how I can write back only the changed records to the xml
file instead of saving the whole file back to disk.

Thanks,
Paul
 
Hi Ken,

Just to clarify. Whilst I want to write back the modifications I want to
retain the remainder of the records in the original file.

Here are the steps:
1) Read whole xml file into dataset.
2) Make some edits/deletes/adds to the dataset.
3) Update the original xml file with the changes.


Thanks,
Paul
 
Paul,

Ken showed you exactly what you asked for in the subject, while I did
understand you would write only the changes in "the" existing file, what is
impossible, the XML file is just a plain txt file as an html file is and
others like that and therefore you have always to write the whole file.

I hope this helps,

Cor
 
Thanks to both of you,

I should of caught on to that earlier and last night having spent the whole
day reading etc I realised it. I'm use to writing records into a database
and have (as yet) little xml experience.

I guess the whole file will just have to be written out each time the user
saves. It is really too small to warrent a database.

Thanks again,
Paul
 
Thanks to both of you,

I should of caught on to that earlier and last night having spent the whole
day reading etc I realised it. I'm use to writing records into a database
and have (as yet) little xml experience.

I guess the whole file will just have to be written out each time the user
saves. It is really too small to warrent a database.

Thanks again,
Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top