13

I am writing a small program for our local high school (pro bono). The program has an interface allows the user to enter school holidays. This is a simple stand alone Windows app.

What format should I use to store the data? A big relational data is obviously overkill.

My initial plan was to store the data in an XML file. Co-workers have been suggesting that I use JSON files, Access Databases, SQL Lite, and SQL Server Express. There was even a suggestion of old school INI files.

wcm
  • 9,045
  • 7
  • 39
  • 64
  • 2
    Have to ask, how many users will use that database? Are they going to use it everybody at once? Then probably an xml-file is a bad idea if you do not wish to have one per user. – Oskar Kjellin Apr 19 '10 at 13:16
  • What exactly does your program do? If it only lists holidays and allows users to enter holidays, I don't see why you need anything but a simple text file... – IVlad Apr 19 '10 at 13:20
  • There will only be one or two users of this app, Oskar. I don't have any knowledge of their networks or databases. They don't use Outlook. My thought was that they could simply save it to a folder and make a link to their desktop. I will probably have to show them how to do that ;o) – wcm Apr 19 '10 at 13:47
  • Go with XML, it will fulfill your needs for this small app. – Oskar Kjellin Apr 19 '10 at 13:50
  • It does a bit more than show holidays, IVlad. It is basically an aid to help them with scheduling. There are a number of rules around scheduling different types of things relating to special needs children that I am trying to help the school deal with. I could probably do this with an Excel spreadsheet and a little VBA, but that's not my way :) – wcm Apr 19 '10 at 13:51
  • Thanks for everyone's input. StackOverflow people totally rock. I've decided to go with SQL Lite, in case anyone is interested :) – wcm Apr 19 '10 at 22:10
  • Read up on this question: http://stackoverflow.com/questions/2648802/at-what-point-is-it-worth-using-a-database/2658658#2658658 As a I say in my answer, the type of data, growth rate and performance needs are often more important than the amount of data. – Ash Apr 20 '10 at 04:25

10 Answers10

10

Projects like this have a habit of getting bigger, quickly, and if they do your XML file will become complex and a burden to manage.

I would not recommend storing the data in an xml file or json - they are just text files by a different name, all suffering from the same problem - you don't have any control over who edits them.

Use some kind of db, starting from the small ones first (Access, SQLLite)

Edit

Based on your latest comments, roll forward to a point where the users have been using the app for two years.

  • How much data do you expect to have stored by then?
  • Will the user(s) need to look back through historic data to see, for example, what they did this time last year

And more so, right now

  • What is Teacher A doing on Thursday afternoon
  • Will Teacher B be free to attend event on 15th May 2010?
  • Can Student C attend event D?

All of these questions/problems are a lot easier/more efficient to handle with SQL. Plus your resulting codebase will make a lot more sense. Traversing XML isn't the prettiest of things to do.

Plus if your user base is familiar with Excel already, linking Excel to a SQL database (and produce custom results) is a lot easier than doing the same with XML.

CResults
  • 5,100
  • 1
  • 22
  • 28
  • You make excellent points in your edit. However this scheduling issue has less to do with teacher or student availability than state and federal rules about how much time needs to pass for different kinds of reviews and meetings. Thanks for your input :o) – wcm Apr 19 '10 at 15:41
  • 1
    +1 for pushing for a db of some sort. Apps originally written for two users have two lifetime endpoints: 0 users because the app is bad or unnecessary, in which case it doesn't matter what you do, or many users because it keeps growing, in which case if you don't have some db technology up front, you will pay dearly for it later. – cdkMoose Apr 19 '10 at 22:54
3

I would have to second the Json answer and SQL Lite.

Another option would be to use the built in database that's included in all of windows (since Windows 2000), ESENT. There is a codeplex project to make it easy to work with http://managedesent.codeplex.com/

Chris Marisic
  • 32,487
  • 24
  • 164
  • 258
  • 1
    I always wonder why this seems to be so little of a popular answer when anyone asks a question about a local data store for an application and there's already a database provided by Microsoft ready to go. Although I believe it's alot more like a NoSQL db vs normal db. – Chris Marisic Apr 19 '10 at 23:18
3

Have you considered using SQLite? It'll result in a small .s3db file. SQLite is used by all kinds of desktop applications for local storage.

There's a SQLite .NET library that'll allow you to use ADO.NET to CRUD your data.

Check out Mike Duncan's article on how to get started with SQLite in .NET.

p.campbell
  • 98,673
  • 67
  • 256
  • 322
  • 1
    Going with SQLite also puts you in a good position to move to a chunkier database should requirements later demand it. – Quentin Apr 19 '10 at 13:24
2

Hm, obviously SQL Express is a full blown database - otohj it may make sense. Why NOT use a databsae if they already have one ?;)

Otherwise I would possibly go with a XML file.

TomTom
  • 61,059
  • 10
  • 88
  • 148
2

I would recommend an XML file and a typed dataset.
You will need to figure out where to put the XML file.

Note that if you ever want to allow multiple users to use it, you need to use a database, such as Access or SQL Server.

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
  • Point taken. Right now, only one or two people in the special education department will be using it. – wcm Apr 19 '10 at 13:16
  • Why does he *need* to use a database for multiple users? The only issues would be with updating the data inside the file but that can still be easily controlled through only allowing 1 editor at a time. – Chris Marisic Apr 19 '10 at 13:20
1

I'd go for

  • SQL Server Express (free and full blown relational database)
  • XML/JSON if you don't want a database (LINQ to XML might be a big help here).
Bart
  • 9,925
  • 7
  • 47
  • 64
1

xml files seems to be a good option. using Linq to xml it should be quite easy to read/write the files from objects/to objects. check out XDocument and XElement classes Access Databases, SQL Lite, and SQL Server Express seens like an overkill. do you really need a database to store a simple calendar data? is your application going to grow?

Ami
  • 1,110
  • 1
  • 13
  • 26
1

From "simple stand alone Windows app" it sounds to me like it's not critical. I'd go with whatever is easiest, or what you are most comfortable with. XML is usefully human readable, but a sensibly formatted flat file might be just as sensible.

penguat
  • 1,337
  • 1
  • 13
  • 25
0

I'd use serialized classes.

NibblyPig
  • 51,118
  • 72
  • 200
  • 356
0

One thing to consider if you use a database instead of a text file of some sort: you're no longer a "simple stand alone Windows app". Now you've (most likely) got an installation program to write.

I. J. Kennedy
  • 24,725
  • 16
  • 62
  • 87