Search code examples
c#databaseflat-file

csharp flat file database for a standalone windows application


A question like this has been asked differently several times. Yet here i am.

I am writing a standalone windows program which will get user input like three fields and have to store it in the disk.

Also i need to delete them, edit them and so on.

It should be UTF8.

Besides here is the actual need.

I have hosted this application in my server and users can download it.

I want the db automatically created when the program is executed for the first time.

What i mean is user can or should download only one file and that is the program.

The program will be one exe file and it will not have any dependencies.

meanwhile asking this question i tried sqllite for .net 2.0 and i got an installer from sourceforge and installed it.

I included in my application and it showed an error like there is a problem in that.

So, if people suggest sqlite then please give me reference of how to include in c#.net v2.0

I am new to .net so it is taking a very long time to fit things together so thought of posting this question.

any comments, suggestions, advices and references would do good.

EDIT

I have attached the error what i got

enter image description here

Edit after first reply

A user can save as many as set of three fields. I mentioned three fields for an example. They will save as many as records as they want. It could 100 to infinity.


Solution

  • If that's only 3 fields to store - forget about databases and store the data in an XML file.

    You can create a class that has these 3 properties, and then serialize/deserialize it on demand.

    Here's a nice tutorial from Microsoft about XML serialization: http://support.microsoft.com/kb/815813
    Deserialization is done in a very similar fashion.