Iain's IT Solutions Ltd.

Iain's IT Solutions Ltd Mobile Nav Menu

XML database


I'm currently working on a C#/Visual Studio/Windows Forms desktop application.  It's target audience will be individuals who'll be running it on their local PCs and laptops.  A database is required, but using a regular SQL database isn't practical.

SQL Server requires a complicated installation on the users machine.  It also relies on the service starting automatically each time the machine starts (sometimes on my own PC, the service doesn't start automatically).

Microsoft's Jet database would be good as it runs on the file system, but there's then a dependency on the user having MS Access or at least Access runtime installed.

MySQL - same issue with a complicated install being needed on the users machine, also, I've never tried connecting Visual Studio to MySQL.

The solution we've come up with is using a structured XML document.  Using the C# System.XML.LINQ library, it's possible to connect to an XML document and query and update its data in a similar way to updating a database.

The way you've to write code isn't as clean as I was hoping, but it does seem to work.  Elements can be added and deleted, values updated and lists of elements queried.  I'm currently though trying to figure out how to read and update nested elements.  It may have something to do with a Descendants method....but I've not figured it out yet.

So it's looking like a good way to get a database onto a local machine, using only the file system.

No links allowed (to stop persistent spamming...)
