Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 149,934 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,490 people online right now. Registration is fast and FREE... Join Now!




Database vs. File

 
Reply to this topicStart new topic

Database vs. File

SentencedToLive
14 Dec, 2007 - 09:08 AM
Post #1

New D.I.C Head
*

Joined: 14 Dec, 2007
Posts: 1


My Contributions
Hi everyone, I`m new here and I hope you can help me with this!

Basically, I'm developing a Windows application, which works this way:

- The user introduces a number of parameters, in a form. These parameters are stored.

- Based on those parameters, the app generates a number of reports (defined by the user), and those must be stored too.

I want to know what you think about how should I store it... First I though about a database, with one table with those main parameters, another one with the generated reports parameters, and some secondary tables... Then I though that it would be better to have a .txt file with the main parameters (which the user can open anytime to use them again) and then another .txt file with the generated parameters for the reports... but I don't know how to separate them inside the txt file...

The data of every report would be something like, for example:

Name: A5
Height: 120
Width: 40
Time: 4.24
Color: Blue

Maybe stored in a comma delimited way...
I just need some guidance to put some order on mi toughts!!!

User is offlineProfile CardPM
+Quote Post

Martyr2
RE: Database Vs. File
14 Dec, 2007 - 09:54 AM
Post #2

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 5,655



Thanked: 313 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
Well as you can imagine there are pros and cons to each one. So I should list a few so you can see where you might to go with this...

Databases

Pros

1) They tend to be more structured
2) They have referential integrity to help protect against corruption of data
3) If done correctly they can help format the type of data you are getting (won't allow you to enter a string in an integer field).

Cons

1) You have to connect and use a database. Which in itself can bring problems if you don't have one or not versed in SQL.
2) Little more time to setup and make available.
3) If the database goes down, you could have a lot of people's copy of the software not working.

Files

Pros

1) They are easy to setup and populate.
2) They allow the user to look at them and edit if need be.
3) Typically they are easy to load because they are local.

Cons

1) If the user can look at them and edit, they can also screw up the file.
2) When they get big in size they can be bulky, especially if you need to search.
3) There is no integrity checking to make sure that what is written to the file is in the format it should be in.


Personally if you are going to have a lot of parameters or a variable number of parameters that could end up being a lot, a database would be the way to go. They are structured, can be easily indexed and searched, and often times server-side languages can query and drop the content straight into an object (mysql_fetch_object() for instance in PHP). I would think you would make your reports using a custom report object so that you can easily manipulate reports and juggle them around, sort them etc. But that is just a design idea.

It is up to you to find which fits better with your scheme and how you, and your users, might use the software.

Hope that helps smile.gif

This post has been edited by Martyr2: 14 Dec, 2007 - 09:54 AM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 04:01PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month