Solved

Flat file or backend.mdb file ...vb6

Posted on 2004-10-21
866 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
Question by:Mike Eghtebas
    15 Comments
     
    LVL 48

    Expert Comment

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

    0
     
    LVL 26

    Expert Comment

    by:EDDYKT
    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
    however for flat file you can go up to 4 GB (NTFS)
    0
     
    LVL 48

    Expert Comment

    by:Mikal613
    0
     
    LVL 28

    Expert Comment

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

    Expert Comment

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

    Expert Comment

    by:EDDYKT
    >>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
    4gb of file info

    sllllooooooowwwwww
    0
     
    LVL 48

    Assisted Solution

    by:Mikal613
    0
     
    LVL 33

    Author Comment

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

    Author Comment

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

    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 33

    Author Comment

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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Suggested Solutions

    When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
    If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
    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…

    846 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

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now