Using file as database

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

For a small .net windows service, I am using an xml file as my database. I am
filling a dataset from the xml file (ds.ReadXml(myPath)), working on the
dataset, and the writing back to the xml file (ds.WriteXml(myPath)).

Do I need to use ds.AcceptChanges or ds.Dispose at the end of my code ? The
names suggest that I should be using them, but what are they for ?

Thanks,
Craig
 
Accept changes changes the row's rowstate to "unchanged". Since you are
writing to a file (i assume using the WriteXml function) new vs. unchanged
rowstate has no effect , it will write out the row regaurdless. If you delete
the row, the row state changes to deleted and nothing is written. RowState is
used primarily by DataAdapters to Sync the data with a DB.

As a general rule of thumb, any object that implients Idisposable should be
disposed when you are done using it. The author of the object impliments
idisposable to release expensive resources on command , instead of waiting
for the finalizer to fire. Call dispose when you no longer need the object

Does this help?

Tom Wisnowski
MCP MCAD
 
Back
Top