1

I will build an C# WPF application that intakes USB/RS232 data (~ rate: 10ms) for hours and have to store all these data to a database. User can save all the RS232 data and setting data (e.g. TextBoxes) to a database and also output them to a file. Once they output all the data to a file, the corresponding data in the database will be erased. The user can later, import (or open), the file and load it into the application, and all its data will shown on the display and store back to the database again. I am looking for embedded database solution where user does not need to install a database server separately.

Can embedded (in memory) database, such as SQLite, accomplish such a job?

KMC
  • 19,548
  • 58
  • 164
  • 253

4 Answers4

1

SQLite doesnot require any installation but developing according to SQLite is cumbersome. For example, even above statement gives error.

CREATE TABLE  IF NOT EXISTS firma (firm_id  INTEGER PRIMARY KEY,firm_name TEXT,firma_owner TEXT,counter INTEGER);
1

Why not? There is now SQL Compact Edition 4 with Visual Studio 2010.

Daniel A. White
  • 187,200
  • 47
  • 362
  • 445
1

SQLite does not require installation of a database server. It can also operate in-memory: http://www.sqlite.org/inmemorydb.html

For using C# with SQLite, see: Is there a .NET/C# wrapper for SQLite?

Community
  • 1
  • 1
Matt H
  • 7,311
  • 5
  • 45
  • 54
1

Yes SQLite can do this - there are a couple of points specific to your situations:

  • In order to use an in-memory database you must specify :memory: as the data source on your connection string.
  • In order to copy the in-memory database to disk you must use the SQLite backup API (see this question for more details) - these are not exposed by the System.Data.SQLite data adapter (the one I recommend you use), and so you will need to craft yourself some PInvoke calls.
Community
  • 1
  • 1
Justin
  • 84,773
  • 49
  • 224
  • 367