How2 Flush to Disk DataSet.WriteXML(FileName,XMLWriteMode.WriteSch
- From: "AdvanTouch" <jwsathms@xxxxxxxxxxxxxx>
- Date: Thu, 25 Aug 2005 09:07:03 -0700
VB.Net 2003
Windows Form Application.
A user session consists of long transactions (15- 30 minutes) where data is
stored locally in memory and then submitted to the server at the end of the
transaction for permanent storage. The problem is that if something goes
wrong with the client machine or application the memory data is lost. The
data is stored locally in a dataset. Our solution is to frequently do a
DataSet.WriteXML(FileName,XMLWriteMode.WriteSchema). This works very well in
all situations except one so far. (If the applications crashes, the XML file
is available on the local disk and we have routines to recover it and pick up
where the user left off. (That's what we want). If the computer crashes,
again, the XML file is there. But if the application and/or machine locks up
(or appears to lock up) and the user performs an End Task on our application
from the task manager, the XML file is not written. Note: To test, I can see
the FileName.xml file exists after the first execution of writexml but the
size is 0 bytes (Per Windows Explorer). It stays 0 bytes no mattter how large
in memory it becomes. (Alt Tab to toggle between the app and Explorer -with
refresh always shows 0 bytes). Even though Explorer says 0 bytes, if I then
pull the plug on the PC, the XML file is actually saved to the local disk.
But if I CTL+AlT-Del and say end task from the task manager, the XML file is
Not saved to disk. (That confuses me). But in any event, I assume that if I
could flush the streamwriter(?)/XMLTextWrite after each WriteXML the problem
would be solved. Unfortunately, I can't figure out how to do so. I have tried
to DIM as seprate XMLWriter but when I write to the same writer multiple
times I then can't read it for recovery purposes becuase it appends the
entire dataset each time instead of just the new data since the last write.
I would greatly appreciate any help you can offer. I am not locked in to the
XML soultion, it just works well considering the clients don't have an
alternate database they can use and the current code is simplistic and runs
relatively fast.
Thank you
--
Jim
.
- Prev by Date: RE: NullReferenceException in ResetIndexes
- Next by Date: Changing a field in the SQLDataAdapter to allow null values.
- Previous by thread: Display editable one-to-one data from n tables in one DataGrid...
- Next by thread: Changing a field in the SQLDataAdapter to allow null values.
- Index(es):
Relevant Pages
|
Loading