Overwriting Files

When program EditXml calls the DataSet’s WriteXml method, that method writes all the DataSet’s data into the XML file, overwriting any information that was already there. This is one of the most important differences between XML files and true databases. In a relational database, you can update a single record without modifying the rest of the database’s contents. When you modify XML data, you must rewrite the entire XML file.

This makes building a multi-user application with XML difficult. Suppose two users start the application at the same time and they both make changes. The first user saves his changes, overwriting the original XML file, then the second user saves his changes, overwriting the XML file again. The first user’s ...

Get Visual Basic® .NET Database Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.