WPF C# application using local database

Quass1m picture Quass1m · Aug 7, 2014 · Viewed 15.7k times · Source

I am a novice when it comes to using a database in an application. My task (and sort of a goal) is to create an application in WPF using C# that can connect to/use local database stored on user's computer. The database 'file' should be easy to load and move between machines and, if possible, created on user's PC during the application's installation. The database needs to have an option to be modified from within the application as well as from a respective DB's management tool for updating a large portion of it's content. DB's file security is not an issue in the case of this project. I know that what I've described may have no sense at all and I could simply export applications settings to a file but it's not what I am looking for in this case. So far I have created a DB in Microsoft SQL Server 2014 Express but to be honest I don't know if it's possible to move this DB to another PC in the way I have described (at least without installing a new instance of SQL Server on this machine).

As I have mentioned in the beginning I am a novice regarding database's so any advice is appreciated.

Answer

Jens H picture Jens H · Aug 7, 2014

If I understood you correctly you are looking for some kind of portable database, right? In this case there are multiple established solutions available that work well with C#.

These are a few that might be worth a look for you:

Full grown databases that can be used as embedded version without a server running in the background.

  • Firebird
  • MySql (You might first want to check the license restrictions for using this.)

My recommendation would be SQLite because it is very easy to get running with it. Additionally, there are many, many DB admin tools out there that are freely available. My personal favorite, however, is a paid product, Firebird Maestro. I found working with it quite intuitive and although it is a paid-for product, it is still quite affordable (they also have multiple promotions per year).

But still, there are plenty of other free tools to choose from. Your favorite internet search engine will be your friend. :-)