I have two different options using database in a desktop application. I prefer the Service-based database even locally. But should I use the Local database instead?
-
Depends which database system you can use. SQL Server or SQL Server CE. – Ralf de Kleine Aug 10 '10 at 09:59
-
I have Visual Studio 2010 pro, and MS SQL Server 2008. – Benny Skogberg Aug 10 '10 at 10:01
5 Answers
Best integrated in the .Net / VS enviroment is properly MS SQL Compact:
http://en.wikipedia.org/wiki/SQL_Server_Compact
But there are alternative like:

- 1
- 1

- 17,622
- 5
- 63
- 99
-
The SQLite for Android and Python I'm familiar with, but I didn't know there is one for .NET as well. Thanx for heads up! BR - – Benny Skogberg Aug 10 '10 at 19:00
Usually depends on where it'll be deployed. If you're deploying it in an environment that you control I'd usually go with a service-based, but if you need to send it out to clients it depends on the client. Clients with technical staff would probably want the service-based, but if it's a small client with no technical staff/knowledge that just want to click and run, then a local database might be best.

- 54,199
- 15
- 94
- 116
-
This is important stuff. Sometimes one want to send the app to a non-tech customer just showing capabilities. Your approach on the answer gives my insight I didn't have! BR - – Benny Skogberg Aug 10 '10 at 18:58
Depends of further requirements.
Server-Based: MS-SQL Express. Is essentially the same engine as larger editions, this will scale well when you need it bigger. Note that there is an attached-file mode that means you don't need to permanently register each database with the server.
Local: SQL Compact Editon, embedded file-based solution. Much easier to deploy but not 100% upward compatible. Basically a single-user solution (but that is going to change with v4)

- 263,252
- 30
- 330
- 514
-
Thanx for clearing this out. I'd expect something like this but never really knew exactly pros and cons of the different databases. BR - – Benny Skogberg Aug 10 '10 at 18:55
For a desktop application you should consider using Sqlite, with the C# wrapper library here, I've been using it in a project and it works great, easy to use, quick and everything goes into a single file.
It's not designed for multiple user environment though, so you wouldn't want to use it as the database for a web service backend for instance.
I also use NHibernate and NHibernate.Linq to interact with the data, you can get a build of both which are compatible here: http://www.dennisdoomen.net/2009/07/nhibernate-210-ga-with-linq-and-fluent.html

- 15,701
- 14
- 61
- 104
-
I'm familiar with sqlite in Android and Python environments, but didn't know it worked on .NET as well. Thanx for making this clear for me. BR - – Benny Skogberg Aug 10 '10 at 18:57
-
Also i use SQLITE db in my c# windows application and it's work fine. – nativegrip Aug 23 '17 at 12:10