Flat file or backend.mdb file ...vb6

What are the advantages or disadvantages (or limitations) of a flat file compared to a backend mdb file?  In this case there is no need to built a relationship between the tables.  Could you also give me a sample of a flat file where I can access from a vb6 form to store or retrieve data?

Thanks
LVL 34
Mike EghtebasDatabase and Application DeveloperAsked:
Who is Participating?
 
AjithJoseCommented:
The main advantages of flat file are:

No runtime files required to access the flat file.
As you can read/write directly from VB, operations will be faster than databases
You can use a simple xml file or ini file as flat file

The disadvantages are:

You have to rewrite the entire file for a simple insert operation. Or you have to use complex structures/algorithms to find the records in order. You may have to perform a full rewrite to update a single record, if it is the first one.

Operations like sort, search,index will require much more time than databases.

Advantages of databases are:

They hold the entire data (ie, tables) together. Storage is highly optimized. Conventional data operations such as sort, index, search are very fast. You dont have to worry about anything regarding internal storage of database, database runtime files will handle everything for you.

Disadvantages are:

They require heavy runtime files, for Access, you have to install  ADO/DAO runtimes. They are almost >5MB in size. This makes your install program much bigger size.


Conclusion:

For small amounts of data,  (max records < 500). You can use flat files. Else use database such as mdb


0
 
Mikal613Commented:
go with the database you get quickness,efficiency and structure.

0
 
EDDYKTCommented:
Depends on how many and what kind of data you want to store.


1. access only support up to 2 GB file.
2. fast query using access
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
EDDYKTCommented:
however for flat file you can go up to 4 GB (NTFS)
0
 
vinnyd79Commented:
Actually you can go much more than 4 GB on NTFS with a flat file.
0
 
Mikal613Commented:
e.g  the file for one record you may have to go through the whole file
0
 
EDDYKTCommented:
>>Actually you can go much more than 4 GB on NTFS with a flat file.

You are right about this

http://www.ntfs.com/ntfs_vs_fat.htm
0
 
Mikal613Commented:
4gb of file info

sllllooooooowwwwww
0
 
Mike EghtebasDatabase and Application DeveloperAuthor Commented:
Thank you all,

I have few KB data.  I am using access mdb right now but would like to get rid of it.  I need code to make my first ever flat file (detailed instruction is appreciated).  I don't need structure (if it means relational between the tables, they are not related at all).

Sorry for the delay.

Mike
0
 
Mike EghtebasDatabase and Application DeveloperAuthor Commented:
Hi  AjithJose,

Thank you for good information to help me understand flat files.  I have only few small tables, each with 10 records to 50 records with no more than 5 fields each.  I have Text, Bollean, Number, and Memo fields.

Could you give me some code to get started with?  I will keep this the flat files in a folder in folder in C drive.  It will be nice to make them hidden and/ or password protect them.

Regards,

Mike
0
 
Mikal613Commented:
dim FilPntr as long

FilPntr  =  Freefile()

open "c:\hi.txt" for append as #FilPntr  

write #FilPntr,  txtfee.text,Boolean,number,memo

close #FilPntr  
0
 
AjithJoseCommented:

Read this article:  http://www.quantumcloud.com/forum/viewtopic.php?t=268

You will get a better understanding of the flat file

Please explain the Memo field you are using:

If you want to store multiple lines of text as memo, then you can not store in plain text file as in the above example by Mikal. You have to use store in user defined data types

These urls will certainly help you
How to Work with Random Access Files:  http://support.microsoft.com/?kbid=150700

Contact manager using Random Access Files: www.freevbcode.com/ShowCode.asp?ID=2673

Sequential Access files in VB tutorial: http://www.officecomputertraining.com/vbtutorial/tutpages/decide.asp


0
 
Mike EghtebasDatabase and Application DeveloperAuthor Commented:
Mainly I wasn't sure the final user will have accessinstalled, therefore, I was looking for an alternate way to handle backend issue.  I will give a try to the above solutions later on.  At this point, I am using an access file to do the work (because I am certain the will have excel on their machine, if it is important to have it installed).

Regards to all,

Mike
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.