473,405 Members | 2,167 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Question about difference between text file and database

Hi in a simple application that consists of a couple of user input
forms. I'm wondering what the difference is between using a database
technology and a plain text file?

I've been working on this program for a week or so now and its a hobby
project. I have never understood how to work with databases in visual
studio (although I have strung together a couple of Microsoft access
databases in the past, by trial and error.)

As I don't understand databases I've opted to store the information in
a simple text file. I am delimitting fields with semicolons and using a
fixed format, so for instance I know the name of the person is always
the fifth delimitted bit of data on each line. So to search for a
particular persons records, I have written a class that searches the
fifth bit of data on each line for a matching name. And returns the
results as an array.

I'm just about to add some kind of primary key functionality to my text
file by numbering each record. I'm going to check the text file for
it's last entrys primary key and increment this by one to use as the
next records primary key.

All appears to be working ok.

My question is, am i fundamentally missing some point here? Or is my
simple text file, just as good as a 'database' for my project?

Thanks,

Gary.

Jan 11 '07 #1
3 2058
Hi,

Gary wrote:
Hi in a simple application that consists of a couple of user input
forms. I'm wondering what the difference is between using a database
technology and a plain text file?

I've been working on this program for a week or so now and its a hobby
project. I have never understood how to work with databases in visual
studio (although I have strung together a couple of Microsoft access
databases in the past, by trial and error.)

As I don't understand databases I've opted to store the information in
a simple text file. I am delimitting fields with semicolons and using a
fixed format, so for instance I know the name of the person is always
the fifth delimitted bit of data on each line. So to search for a
particular persons records, I have written a class that searches the
fifth bit of data on each line for a matching name. And returns the
results as an array.

I'm just about to add some kind of primary key functionality to my text
file by numbering each record. I'm going to check the text file for
it's last entrys primary key and increment this by one to use as the
next records primary key.

All appears to be working ok.

My question is, am i fundamentally missing some point here? Or is my
simple text file, just as good as a 'database' for my project?

Thanks,

Gary.
You should consider XML. They have all the advantages of a text file
(they are, in fact, text), but they are very well supported in .NET (no
need to worry about reading, parsing, validating...).

XML is often a very good choice for small projects where you don't want
to have a full blown database.

HTH.
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Jan 11 '07 #2
Thanks for that.

I haven't encountered XML before (short of knowing XML has something to
do with the code snippet technology.) I tried to have a play with it as
a starting point for learning more about it. I found an msdn article.
The article instructs me to add an xml scheme to the project. However I
dont have this as a new item option. I'm using C# express. Are xml
schema's not available in express? Is xml schema the thing I should be
looking at in view of your comments?

As a last resort i do have visual studio at home which I could install
at the office, but i'd rather stay with express on the office pc if
possible.

Thanks!

Gary.

Laurent Bugnion [MVP] wrote:
Hi,

Gary wrote:
Hi in a simple application that consists of a couple of user input
forms. I'm wondering what the difference is between using a database
technology and a plain text file?

I've been working on this program for a week or so now and its a hobby
project. I have never understood how to work with databases in visual
studio (although I have strung together a couple of Microsoft access
databases in the past, by trial and error.)

As I don't understand databases I've opted to store the information in
a simple text file. I am delimitting fields with semicolons and using a
fixed format, so for instance I know the name of the person is always
the fifth delimitted bit of data on each line. So to search for a
particular persons records, I have written a class that searches the
fifth bit of data on each line for a matching name. And returns the
results as an array.

I'm just about to add some kind of primary key functionality to my text
file by numbering each record. I'm going to check the text file for
it's last entrys primary key and increment this by one to use as the
next records primary key.

All appears to be working ok.

My question is, am i fundamentally missing some point here? Or is my
simple text file, just as good as a 'database' for my project?

Thanks,

Gary.

You should consider XML. They have all the advantages of a text file
(they are, in fact, text), but they are very well supported in .NET (no
need to worry about reading, parsing, validating...).

XML is often a very good choice for small projects where you don't want
to have a full blown database.

HTH.
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Jan 11 '07 #3
Hi,

Gary wrote:
Thanks for that.

I haven't encountered XML before (short of knowing XML has something to
do with the code snippet technology.)
I am not sure what you mean with this. XML (eXtensible Markup Language)
is a text-based language, where you represent objects or structure
through hierarchies of tags. These tags can also have attributes, which
can be used to represent properties of objects. This is a very reductive
definition of XML, more information can be found here:

http://en.wikipedia.org/wiki/Xml
I tried to have a play with it as
a starting point for learning more about it. I found an msdn article.
The article instructs me to add an xml scheme to the project. However I
dont have this as a new item option. I'm using C# express. Are xml
schema's not available in express? Is xml schema the thing I should be
looking at in view of your comments?
XML schemas are not totally necessary to a XML file, especially not when
you are starting to learn it, but they can help later. A XML schema (XSD
file, or DTD file (but that's older and I wouldn't recommend it)) are
used to describe the structure of an XML file. Since XML is extensible,
you can define your own tags and attributes. Through the XSD file, you
describe how your XML file is organized (for example: The main node must
be named "MainTest"; the first child must be of type "HelloWorld";
"HelloWorld" may occur only 2 times in the hierarchy; etc...).

If you define a XSD file, then editors like Visual Studio help you with
data entry by showing you an intellisense box when you type, so you can
select the node or the attribute you want to add. It also helps you by
validating what you type, i.e. comparing it against the schema and
underlining what does not conform.

However, for a first try, I would recommend you forget schemas for the
moment. You can create an XML file in any text editor.
>
As a last resort i do have visual studio at home which I could install
at the office, but i'd rather stay with express on the office pc if
possible.
I am not familiar with Express, but I don't see why that shouldn't be
possible. My advice is to check the web for simple examples of XML
files, define your own data structure, and start coding ;-)
Thanks!

Gary.
Greetings,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Jan 12 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: J. Campbell | last post by:
I'm wanting to output a text header file in front of the data portion of an output file. However when I use "\n" or "endl" as end of line, it just puts a 0x0a in the file(which is...
3
by: Ian Taite | last post by:
Hello, I'm exploring why one of my C# .NET apps has "high" memory usage, and whether I can reduce the memory usage. I have an app that wakes up and processes text files into a database...
1
by: siliconwafer | last post by:
Hi All, here is one code: int main() { FILE*fp; unsigned long a; fp = fopen("my_file.txt","w+"); a = 24; fprintf(fp,"%ld",a); while(fscanf(fp,"%ld",&a) == 1) {
2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
29
by: MP | last post by:
Greets, context: vb6/ado/.mdb/jet 4.0 (no access)/sql beginning learner, first database, planning stages (I think the underlying question here is whether to normalize or not to normalize this...
34
by: Mathieu Trentesaux | last post by:
Hello I downloaded Office 2007 for this reason : It seems, once again, that it is impossible to save any modification done in a VBA library, from the main project in Access. The save button...
9
by: HC | last post by:
Hello, all, I started out thinking my problems were elsewhere but as I have worked through this I have isolated my problem, currently, as a difference between MSDE and SQL Express 2005 (I'll just...
3
by: Stinky Pete | last post by:
Hi, OK, I admit it from the outset, this may seem like a really silly question but an explanation is stumping me. The file I have been modifying runs a query when the main form & subform...
5
by: CP | last post by:
Hello: I have a database with 300,000 records. I have two "DATE" columns and I need to calcluate the difference and display the number of days in one of the reports. I was wondering if this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.