Database Help 
Author Message
 Database Help

Can anybody please help me with databases in TP.  I just need to know
the basics of how to store,add, delete and search data.

Thanks in advance

Programmer X

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Wed, 18 Jun 1902 08:00:00 GMT  
 Database Help

Quote:

> Can anybody please help me with databases in TP.  I just need to know
> the basics of how to store,add, delete and search data.

This is a little bit of "much"...
There was a database toolbox available from Borland, but it was
discontinued many years ago, it was made for TP 3 and later for
TP 4. The files were named Access and TAccess or similar.

Here is a rudimentary part of this approach, but not including
the btree index files:
http://bsn.ch/tp-links
chapter "source" look for DataFile unit.

:-)
--
Franz Glaser, Glasau 3, A-4191 Vorderweissenbach Austria +43-7219-7035-0
Muehlviertler Elektronik Glaser.  Industrial control and instrumentation
http://members.eunet.at/meg-glaser/    http://members.xoom.com/f_glaser/
http://www.geocities.com/~franzglaser/            http://start.at/bedarf



Wed, 18 Jun 1902 08:00:00 GMT  
 Database Help
The following snippet opens a DbaseIII type DBF file
type
 PDataBase=^TDataBase;
  TDataBase=object(TObject)
  FileName:String;
  HeaderSize:Word;
   Dirty:Boolean;
  RecordLength:Word;
  RecordCount:LongInt;
  RecordPos:LongInt;
  Fields:PCollection;
  RecordBuffer:array [0..1024] of Char; (*PMemBlock;*)
  procedure Update(var f:File);
  function FirstRecord:Boolean;
  function NextRecord:Boolean;
  function PreviousRecord:Boolean;
  constructor Init(s:String);
  destructor Done; virtual;
 end;
var
 DBF:array [0..MaxBase] of PDataBase; (* open several files at once *)
 NewRecPos : LongInt;
 Match : Boolean;
constructor TDataBase.Init(s:String);
var
 f:File;
 n,u,i,lw:Word;
 B:Boolean;
 df:PDataField;
begin
 NewRecPos := 0;
    Match := False;
 (* s is filename *)
 TObject.Init;
 FileName:=s;
 Assign(f,s);
 Reset(f,1);
 (* get database version... *)
 Seek(f,4);
 BlockRead(f,RecordCount,4,u);
 BlockRead(f,HeaderSize,2,u);
 BlockRead(f,RecordLength,2,u);
(*  GetMem(RecordBuffer,RecordLength);  *)
 Seek(f,32);
 Fields:=New(PCollection,Init(20,20));
 (* load fields *)
 n:=(HeaderSize div 32)-1;
 i:=0;
 lw:=1;
 while i<n do
 begin
  df:=New(PDataField,Init(f));
  df^.FieldOffset:=lw;
  lw:=lw+df^.FieldWidth;
  Fields^.Insert(df);
  Inc(i);
 end;
 B:=FirstRecord;
 Close(f);
  end;

Quote:
> Can anybody please help me with databases in TP.  I just need to know
> the basics of how to store,add, delete and search data.

> Thanks in advance

> Programmer X

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. database help?

2. Delphi beginner in need of database help

3. Search database help

4. Storing icons in a database - Help

5. c-tree databases - help!!

6. Networking Delphi Databases - help requested

7. Free Delphi Database Help and Discussion

8. Database help needed, please

9. diary database help please

10. Standalone Database - help!

11. Loading ASCII data into Delphi databases - HELP!

12. Connect to Access database: HELP

 

 
Powered by phpBB® Forum Software