views:

113

answers:

4

I am looking for ways to store data in a windows form application in .NET. I want to make the input data of a system persistent, so when I close my program and open it again, the data is retrieved.

Which ways are of doing this besides creating a linked database? Examples are gladly appreciated

regards

A: 

Examples? Do your homework yourself :)

Anyhow, possible ways are:

  • Registry.
  • Files. Liike word does. Or like an ini file, like most games do for example for their settings
  • Databaase

Which makes sense depends on what the application DOES and other scenarios around it. A fast answer is not really possible without knowing more.

TomTom
+1  A: 

An easy way would be to make use of XML.

Using XML in C# in the simplest way

Read/Write Xml document with FileStream

astander
Oops astander!!, you beat me :)
Srinivas Reddy Thatiparthy
+13  A: 

There are dozens of different ways to store data. It completely depends on what data. Is it:

  • Just a couple of configuration values? Use the built-in Settings library.
  • Machine-wide configuration? Use the registry.
  • Transactional? Use a relational database.
  • Related but not transactional? Use a lightweight database like SQLite or SQLCE.
  • Structured but not related? Use XML or JSON files.
  • Somewhat structured and high in volume? Use a NoSQL solution like MongoDB.

And so on... there are different solutions for every storage requirement and many projects make use of more than one at a time.

Aaronaught
+1 for detailed answer.I wish there was fav answers
Srinivas Reddy Thatiparthy
+1 for describing that there are many options - you don't just use XML for all app settings files. Too many people use a single methodology for all purposes.
JMTyler
If you have data which is transactional, but not relational you can use the built-int ESENT database.
Laurion Burchall
A: 

If your data is not mission critical (e.g. user preferences), you could just serialise your objects to file, and de-serialise them next time the app is loaded.

JonoW