Using file as database

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
 
G

Guest

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
 

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