473,401 Members | 2,127 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

Datasets - writing only changed records to xml file

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
Nov 21 '05 #1
5 1173
Hi,

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

Dim dsChanges As New DataSet

dsChanges.Tables.Add(dtChanges)

dsChanges.WriteXml("Changes.xml")

Ken

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

"Paul" <pa**@nospam.com> wrote in message
news:uC*************@tk2msftngp13.phx.gbl...
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

Nov 21 '05 #2
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
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

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

Dim dsChanges As New DataSet

dsChanges.Tables.Add(dtChanges)

dsChanges.WriteXml("Changes.xml")

Ken

Nov 21 '05 #3
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
Nov 21 '05 #4
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

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:e7**************@TK2MSFTNGP10.phx.gbl...
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

Nov 21 '05 #5
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

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:e7**************@TK2MSFTNGP10.phx.gbl...
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


Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: JC | last post by:
I am using Mysql version: 4.0.18-max-log and trying to populate a database from a text file using source option from inside the mysql environment. The population run OK but when creating the...
4
by: Jens Mittag | last post by:
Hi! In my code, I have an array of a structure, which I want to save to a binary file. When the array is just created, everything works fine, but when I change contents of the array, saving...
4
by: Dave | last post by:
(My apologies for posting this on two forums. I have just found out the other one was the incorrect location) I am writing a VB.NET 2003 web application to operate on my company's intranet. It...
0
by: Michael | last post by:
Okay, maybe I am missing something. I created a dataset through VS2005 data manager. The set includes tables with child relationships. The tables and the relationships are included in the dataset....
5
by: sql_er | last post by:
Guys, I have an XML file which is 233MB in size. It was created by loading 6 tables from an sql server database into a dataset object and then writing out the contents from this dataset into an...
21
by: Peter Bradley | last post by:
Hi all, This post is sort of tangentially related to my earlier posts on configuration files for DLLs. Does anyone know how to create typed DataSets using VS2005's new DataSet designer, but...
12
by: BillE | last post by:
I'm trying to decide if it is better to use typed datasets or business objects, so I would appreciate any thoughts from someone with more experience. When I use a business object to populate a...
0
by: kevin.jennings | last post by:
Hi! I'm an "old-school" programmer used to dealing with data one record at a time (using old RPG code like 'chain' and 'read' statements). I'm not used to dealing with huge chunks of data at one...
1
by: Mark Baldwin | last post by:
Steven Thanks for your reply, however the typed datasets are defined in the web service and there seems to way to open the partial class code window - double clicking on the design surface does...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.