Can I guarantee that DataSet data is persisted to disk when serialized?

B

Bill

I have a DataSet that is serialized to a local disk. One of the testers
recently experienced a problem where data was saved and the Tablet PC she
was testing later went offline. When she restarted the system, the XML
DataSet appears to have been corrupted and the application is generating an
error "This is an unexpected token. The expected token is 'EndElement', line
26680, position 24."

She has not returned the Tablet, so I haven't had a chance to look at it
yet. But I am wondering if the searlized data was still partially in cache
and not completely persisted.

Is this possible? Corrupted data is NOT an option.
 
J

Jaxson Tammaru

I've only seen errors like that if the dataset gets interrupted during
saving, are you sure it wasn't in the process of being serialized when the
system went offline?
 
B

Bill

"Jaxson Tammaru"
<JaxsonREMOVETOSEND.TamREMOVEmaru@diaIFYOUWISHTOSENDMEAMAILREMOVETHISmetric.
org> wrote in message news:[email protected]...
I've only seen errors like that if the dataset gets interrupted during
saving, are you sure it wasn't in the process of being serialized when the
system went offline?

Hard to say. Users don't always describe their scenario's accurately.

Regardless, even if the corruption occurs during saving I need something to
protect against it.

I am thinking of doing the save using a *.tmp" extension and renaming it to
".xml" when completed.

Would that help?

(We will be upgrading the application to use MSDE in the future, but this
compromise was done for the sake of project timelines.)
 
J

Jaxson Tammaru

Yes thats what I do when saving those kind of files create the .tmp file
first then only once it has finished saving copy it over the other file and
delete the .tmp file.
You then also have to make sure that on boot up the program can recognise
each possible scenario of things going wrong when saving (e.g. if there is
both a temp and an xml whats it going to do etc.....).
All this is usually why people use databases so much I guess...
 
B

Bill

"Jaxson Tammaru"
<JaxsonREMOVETOSEND.TamREMOVEmaru@diaIFYOUWISHTOSENDMEAMAILREMOVETHISmetric.
org> wrote in message news:[email protected]...
All this is usually why people use databases so much I guess...

Agreed. I intend to port this to MSDE, but time constraints prevented it in
the first release.
 

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

Top