Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XML or SQL?

Tags:

c#

database

xml

I am just beginning to get into desktop application development, and have chosen C# to do so. After making some basic programs, I am wanting to get into more useful creations for myself. I was thinking about making a Project time tracker, as well as a password safe type program of my own. Both of these require taking in information that needs to be stored.

The way I have come across is to use a SQL server for the storage aspect, but from what I have gathered that requires me to have a SQL server installation on all the computers I plan to use these programs with does it not? So I have been leaning towards XML, as it seems to be more mobile and open, but is this a viable option for data storage? And can it be properly encrypted when I get to that step in my password safe program?

Which of these should I begin to implement in my desktop based applications, or is there an alternative I have missed that would be better.


2 Answers

I use sqlite for desktop apps that need a good way to store relational information. Lots of other people do too.

SQLite is easy, robust, fast, and light. There are plenty of .NET data providers for sqlite, and there's a nice SQLite browser app to check out your data file.

SQL Server [Express] is appropriate for "big" apps, or apps that need features of a "real" sql database (like stored procedures or something). You can do an embedded sql server express, if you have enough memory on your target machines.

XML is appropriate for (read-only) configuration info, but using it as a r/w storage format is just asking for a lot of time in your debugger.

like image 71
Seth Avatar answered Mar 02 '26 07:03

Seth


SQL Server is not good at all for desktop applications. However, if you want to use a database instead of XML, you should use the SQLite database format, due to not requiring a server, and requires only a single DLL contining both the DB engine and an ADO.NET driver.

like image 30
MiffTheFox Avatar answered Mar 02 '26 06:03

MiffTheFox