Here below is an example how to read records from a FILENAME.DBF (containing 2 fields; FIELD1 and FIELD2). Don't forget to provide the DBF file on the same directory where the project will be saved - a CDX index file required depends on the DBF typically records. Reading DBF records as simply as using SQL SELECT query just like usual.
To create this basic project, all we need is only TQuery and TButton. Just put it both on a blank form.
The TQuery will work with DBF in a native way. Here is the code, take an attention on a bold sign below.
procedure TFMain.TButtonClick(Sender: TObject);
var FIELD1,FIELD2 : string;
qDBF1.SQL.Add('select * from FILENAME');
Anyway, I supposed that manipulating DBF record using TQuery component will have the same way by using INSERT, UPDATE and DELETE clauses. In other words, "Just like usual…" :) Cheers!!!
PS: If you've benefit from this blog,
you can support it by making a small contribution.