-2

I wrote a reminder program that runs automatically on startup. I want to know if there is a way, other than SQL-Server, to store event, date and time data. I do not want to use SQL-Server for this work, because I think SQL-Server is very big for this simple task. I think that I can use a file to store data in it. What do you think about this?

Matthias
  • 15,919
  • 5
  • 39
  • 84
Arash
  • 3,013
  • 10
  • 52
  • 74

4 Answers4

3

Some common ways to store information:

  • As a file. You have many options where you can store the file. For instance, user directory, and program directory. Further explanation here and here. I prefer using a serializer (xml or json).
  • As a registry entry. You store your information as key-value pairs.
  • In a light-weight database:
    • RavenDB: its document-oriented, and stores data in json format
    • SQLite: relational; I recommend this SQLite Admin for managing purpose

Registry entries are more safe regarding user actions. On the other hand, files can be easily deleted.

You always have the option, to encrypt your information.

As a side note, you can also use PostSharp to declare variables to be stored in your registry. The code becomes something like this:

[RegistryBacking]
private bool _boolean;

I can provide code later if you need it... when I'm home again.

Matthias
  • 15,919
  • 5
  • 39
  • 84
1

XML. .NET has classes that makes handling xml files easy. If you're saving structured data then XML might be your best bet.

radarbob
  • 4,964
  • 2
  • 23
  • 36
1

For the part where to persist

From this document (Managing User Data Deployment Guide, download):

Windows uses the Local and LocalLow folders for application data that does not roam with the user. Usually this data is either machine specific or too large to roam.

Windows uses the Roaming folder for application specific data, such as custom dictionaries, which are machine independent and should roam with the user profile.

So, I suggest using AppData\Roaming and persisting to a file since I consider a 'reminder app' to be user specific. And domain users for example would consider that valuable (syncing to server).

Local and LocalLow (the latter is used for low integrity mode, for applications with reduced privileges) would be more appropriate for some machine/installation specific data which can be calculated on-the-fly.

Registry seems great for some low amount of keys, but doesn't seem to be the best option for such use.

There is another option - IsolatedStorage, which should be used when mentioned options are not applicable, like when using ClickOnce deployments.

For the part how to persist your data to a file ... well, pick your favorite. You could use SQLite database which comes really lightweigt if you want more control and power or just use XML serialization to a file if you consider using SQLite an overkill. Or any of other viable options.

doblak
  • 3,036
  • 1
  • 27
  • 22
  • thanks for your answer,i want to know how sholud i save info into Roaming folder?i insert data into a file and then put in a folder that i makes for example reminder folder?? – Arash Feb 12 '12 at 08:34
  • I already pointed you to this in my post. See http://msdn.microsoft.com/en-us/library/system.environment.specialfolder.aspx – Matthias Feb 13 '12 at 16:24
1

I have for very similar reasons tried some easy to deploy databases and yet use the knowledge i have.

VistaDB 3.x and 4 are my first choice because they are very much SQL Server compaible and allows me to switch to sql server anytime i like. This supports EF too!!!

Next is db4o by Versant which is very very handy. I use it mostly for quick prototyping but i have deployed to several small solutions and perfect for your kind of application.

I hope that helps!

Digvijay
  • 361
  • 1
  • 9