[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Flat file or backend.mdb file ...vb6

Posted on 2004-10-21
15
Medium Priority
?
896 Views
Last Modified: 2008-03-10
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
0
Comment
Question by:Mike Eghtebas
  • 6
  • 3
  • 3
  • +2
15 Comments
 
LVL 48

Expert Comment

by:Mikal613
ID: 12372837
go with the database you get quickness,efficiency and structure.

0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 12372842
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
 
LVL 26

Expert Comment

by:EDDYKT
ID: 12372847
however for flat file you can go up to 4 GB (NTFS)
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
LVL 48

Expert Comment

by:Mikal613
ID: 12372851
0
 
LVL 28

Expert Comment

by:vinnyd79
ID: 12372869
Actually you can go much more than 4 GB on NTFS with a flat file.
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 12372909
e.g  the file for one record you may have to go through the whole file
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 12373083
>>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
 
LVL 48

Expert Comment

by:Mikal613
ID: 12373107
4gb of file info

sllllooooooowwwwww
0
 
LVL 48

Assisted Solution

by:Mikal613
Mikal613 earned 800 total points
ID: 12373124
0
 
LVL 34

Author Comment

by:Mike Eghtebas
ID: 12374214
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
 
LVL 4

Accepted Solution

by:
AjithJose earned 1200 total points
ID: 12374757
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
 
LVL 34

Author Comment

by:Mike Eghtebas
ID: 12374910
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
 
LVL 48

Assisted Solution

by:Mikal613
Mikal613 earned 800 total points
ID: 12375065
dim FilPntr as long

FilPntr  =  Freefile()

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

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

close #FilPntr  
0
 
LVL 4

Assisted Solution

by:AjithJose
AjithJose earned 1200 total points
ID: 12375386

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
 
LVL 34

Author Comment

by:Mike Eghtebas
ID: 12376777
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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

591 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question