Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF C# application using local database

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.

like image 817
Quass1m Avatar asked Aug 07 '14 07:08

Quass1m


People also ask

Is WPF and C# same?

WPF and C#While XAML is used to build user interfaces in WPF, C# is used as the code-behind languages in WPF. While Windows and their controls are created in XAML at design-time, they can also be created at runtime using C# language. C# is also used to write all events programming and business logic.

Is WPF still relevant 2022?

“WPF would be dead in 2022 because Microsoft doesn't need to be promoting non-mobile and non-cloud technology. But WPF might be alive in that sense if it's the best solution for fulfilling specific customer needs today. Therefore, having a hefty desktop application needs to run on Windows 7 PCs with IE 8.

Is WPF relevant in 2021?

It was in 2006 that Windows Presentation Foundation (WPF) was released with . NET framework 3.0. Over the years it got improved and it is still now in the market in 2021.

What is WPF in C# used for?

Windows Presentation Foundation is a UI framework that creates desktop client applications. The WPF development platform supports a broad set of application development features, including an application model, resources, controls, graphics, layout, data binding, documents, and security.


1 Answers

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:

  • SQLite
  • Microsoft SQL Server Compact (SQL CE)

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. :-)

like image 121
Jens H Avatar answered Sep 19 '22 08:09

Jens H