What should I use? I need to store data, and it only needs to be on the local machine. I will be storing all string variables, and in many columns.
What is the best? Would it even be a database?
What should I use? I need to store data, and it only needs to be on the local machine. I will be storing all string variables, and in many columns.
What is the best? Would it even be a database?
It depends.
How will you be using it?
Without more details, I might recommend XML, MDB, or SQLite.
I would recomend db4o, an object database engine. It's pretty straightforward and no server or installation is needed on the client. Another alternative would be SQLite. You can get the .NET provider here.
Edit
See db4o tutorial here.
You should look at SQLite if you're looking for an RDBMS or something like MongoDB if you're storing objects or similar.
SQL Server Compact 3.5 SP1 does not require installation (You just need to deliver the .dlls, although check the EULA if that's allowed) and is rather straight forward to use.
I would recommend using sqlite, it's a very fast file-only, embedded-able, feature-rich, database. I have a lightweight ORM with C# bindings that abstracts and simplifies access to it. Here is a live web-service demo using sqlite.
Oh yeah db4o is a good choice as well which I also have C# database bindings for that supports C# automatic properties (as the default db4o provider doesn't) and other common data access scenarios.
If you're just looking to store a small amount of data in a fairly simple structure, and aren't going to be doing any complex querying, then consider an XML file. You don't need any additional software, and you can work with it easily using LINQ to XML.
I would highly recommend checking out the serialization framework. It's not even close to the performance of a database, BUT, if you're not talking about a lot of data, it has about 100% less overhead. Serializing objects to a file in .net is child's play:
XmlSerializer serializer = new XmlSerializer(typeof(myObjectType));
using(FileStream stream = new FileStream("file", FileMode.Create, FileAccess.Write)
{
serializer.Serialize(stream, myObject);
}
That's it!
Reading back is pretty much the opposite. LINQ provides even more options. Again, this is not even close to a db in terms of performance, but I have seen many, many implementations wherein a database was extreme overkill for the amount of data being stored. Obviously, if you have a clear need to scale, etc, you'll want to plan for that. Right tool for the right problem and all that.