tags:

views:

235

answers:

8

I'm writing a program in C# that will need to store a few Data Tables on the user's computer and load them back when he restarts the program: Up to about 10000 records consisting of text and integers. I don't want to use a CSV file, and I had some trouble with SQLite. Are there any other good options to try?

+11  A: 

Why not just serialise the datatables directy to binary and save them to disk. Loading you would be as simple as desierlising to datatables again?

Preet Sangha
Using Linq To Objects you can also do queries (including joins), aggregations, etc against those objects. With 10,000 records you will get good speed too (assuming you only have a few tables with that many records of course). I have gotten pretty instantaneous repsonse with up to about 50,000 records. The time is for deserializing, which you won't do on every request. Memory is obviously a limit, especially if you are in shared hosting. You could serialize as binary, XML or JSON very easily, depending on what you need.
jeffa00
You could also use 'Isolated Storage', a less known feature of .net for storage, along with Preet's suggestion.
SoftwareGeek
Good point on the Linq2Objects I forgot all about that.
Preet Sangha
+2  A: 

Are you going to load everything into memory and then do all the processing of data in memory? In that case using a database engine is overkill, a simple XML file would probably do.

Anders Abel
+5  A: 

I like SQL Server Express edition.

AllenG
I like the Sql Server Express option because it gives you an easy upgrade path to the full blown product.
James Westgate
+1  A: 

SQL Express would work. You can use Linq to SQL and access your data easily.,

David Basarab
You can also use Entity Framework.
John Saunders
+10  A: 

The Microsoft equivalent for SQLite is SQL Server Compact. It is free. You just need to redistribute some dlls with your application. The end user won't be forced to install a full fledged db product like SQL Server Express or MySQL to run your application.

dalo
This. Works with the tools, lightweight. Only thing easier is serialization.
Will
This is a much better option if you want RDBMS type behavior in an app just to use for local persistance. SQL Express is SQL Server with an artificially imposed 4GB limit and carries a non-trivial install footprint cost in addition to constantly having a server process running, always unless you shut it down. SQL CE is much lighter weight option and runs in the app process.
Jim Leonardo
+2  A: 

Put your DataTables into a DataSet (if they aren't already) and use the DataSet's WriteXml method to save the contents to an XML file, and ReadXml to reconstitute your DataSet.

If your app is already written to work with DataTables (i.e. you use Sort, Select etc. directly on the DataTable), this is your easiest and simplest solution. The resulting XML file might be too large for your porpoises (since XML is pretty verbose), but probably not given the 10,000 rows.

MusiGenesis
+1  A: 

Personally, I love SQLite (in conjunction with the open source .NET provider, System.Data.SQLite). I'm not sure what kind of issues you had with SQLite, but maybe changing to an easy to use provider will help.

Giovanni Galbo
That's what we use... for both the compact framework and the desktop. Works great for our purposes.
Jason Down
A: 

Firebird work perfectly with dotNet and can be use for this too.

Hugues Van Landeghem