Pascal

Moderators: None (Apply to moderate this forum)
Number of threads: 4106
Number of posts: 14016

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Load data from Access file into array of records Posted by earnestto on 20 Sept 2005 at 5:18 AM
I have an Access database file with a number of designated fields, such as name, age, gender, address, telno, etc. and want to import the data into an array of records in a Pascal program.

Is it possible?

Report
Re: Load data from Access file into array of records Posted by zibadian on 20 Sept 2005 at 10:41 AM
: I have an Access database file with a number of designated fields, such as name, age, gender, address, telno, etc. and want to import the data into an array of records in a Pascal program.
:
: Is it possible?
:
:
Yes it's possible. A database is nothing more than a list of records. You have to learn the structure of that file before you can read it. Luckily most databases use fixed record lengths, which is indicated in the field definitions. Once you have read that, you know the length of each field, and thus the lengh of the record. If you want to read this one structure, it is easiest to hard-code it into your program.
If you want to read more different structures, you might need to consider using an Access DB driver instead.
Report
Re: Load data from Access file into array of records Posted by Phat Nat on 23 Sept 2005 at 1:29 PM
: I have an Access database file with a number of designated fields, such as name, age, gender, address, telno, etc. and want to import the data into an array of records in a Pascal program.
:
: Is it possible?


If you can't find the format online, I like to use a text editer and look for the first record I recognize and make it a new line. Then look for the Next one and make it a line. Do this with 4-10 records and see if they are all the same length (remember that most editors will show TABs as 3-5 characters instead of 1, so if one or two records seem longer that's probably why).

Once you know how long each record is, it's just a matter of finding out how far into the file it is and how long each segment is (Name, Age, etc)

Phat Nat




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.