DataSet.WriteXml(FileName.xml) aborts, and no exception is thrown

Hi,

I am reading data from several database tables into a dataset and writing it to xml file using DataSet.WriteXML() method - overall the file size could be 7-10mb.  For the most part this works fine, however, on few occasions it has been noticed that only partial data is written to xml, or letter's are missing from tags (like: <TransID>1001</T ansID>).

No exception is thrown - the error is realized only when next time the file is read.  

I would also like to know whether,

1) DataSet.WriteXML() has limitation in terms of the file size? and, can we somehow verify whether the data written by WriteXML() is complete?

2) Is there any other safer way to write the data from the database to xml file?

Thanks in advance,
Mr_EziAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CodeCruiserCommented:
Try retrieving the query results as XML from the SQL Server

http://articles.sitepoint.com/article/data-as-xml-sql-server
0
Mr_EziAuthor Commented:
Thanks for this tip, but it doesn't solve the problem, because I need to write the changes from the application's dataset back into the xml file.

If there is a way to write back just the data I changed that will help a lot!

But I don't think there is one...
0
DabasCommented:
Have you tried DataSet.WriteXML(filename, , XmlWriteMode.DiffGram) ???

Dabas
0
Learn Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

Mr_EziAuthor Commented:
No I didn't, what will that help?
0
DabasCommented:
oops. Remove extra comma
0
DabasCommented:
It is a way to find out only the data that has changed.
You did say that will help a lot

Dabas
0
Mr_EziAuthor Commented:
Oh Let's try it, Thanks
0
grayeCommented:
Hummm.... is this a multi-threaded application?
Here is something to try.... instead of using the file name as the argument to WriteXML, try using a FileStream object.   That way you'd have complete control over the opening, writing, flushing, and closing of the stream.  In theory, that's probably the same steps that are supposed to occur when using just a file name... but what the heck, it's worth a try.
On the other hand, I'd seriously consider runing the File System Checker on that drive to see if you have a corrupted file system.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mr_EziAuthor Commented:
No it's not a multi-threaded application.

Thanks for your tip.

But I want to try first the XmlWriteMode.DiffGram because the problem ONLY happens when I write big files, so if  I'll be able to write just the changes then I'm fine.

But I'm not sure how this works
0
grayeCommented:
Did you do a Check Disk operation on your disk to see if you had any issues?
http://www.ehow.com/how_4967757_run-chkdsk-utility-vista.html 
0
Mr_EziAuthor Commented:
No I'm sure its not a hard drive problem.

I have it on a few different computers
0
Mr_EziAuthor Commented:
Ok I found a way to write just the new data, the problem is that it writes the <MainDataSet>  and </MainDataSet> tags again, How can I get rid of it?

Dim ChangedDS As DataSet = ds.GetChanges()
fs = New FileStream(SDCardPath + "\" + CustomerID + ".xml", IO.FileMode.Append)
ChangedDS.WriteXml(fs)

0
Mr_EziAuthor Commented:
Thanks, I had to figure out the stuff my self, but your tip to use a stream helped a lot...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.