In Delphi for Win32, how to read and write a dbf file in a native way, without the BDE? I know there are some components available in the web, but I have never used any of them, so I don't know wich to choose (if any).
A:
It is not hard to read a DBF file if you don't need indexes. The format is pretty straightforward. A header followed for fixed sized registers. There is a flag in each register which indicates if it is deleted or not. I suggest looking for a component which does what you want. You can find some in Torry's Delphi pages.
Eduardo Mauro
2010-09-25 23:25:29
A:
I used Topaz from Software Science for many years before I got started with Firebird. It was always an excellent library, had a terrific manual and good technical support. It supports indexes and even has an in-memory option. I think it would be a good choice.
+6
A:
You can use ADO to access a DBF File
See ths sample code (using an TAdoConnection
and TAdoDataSet
components).
var
dbf_folder : string;
begin
dbf_folder:='c:\bdd';//set your dbf folder location here
ADOConnection1.LoginPrompt:=false;
ADOConnection1.ConnectionString:=Format('Provider=Microsoft.JET.OLEDB.4.0;Data Source=%s;Extended Properties=dBase IV;',[dbf_folder]);
try
ADOConnection1.Connected:=True;
ADODataSet1.CommandText:='Select * from file.dbf'; //make your SQL query using the name of the dbf file
ADODataSet1.Open;
while not ADODataSet1.eof do
begin
//do your stuff here
//ADODataSet1.FieldByName('').AsString
ADODataSet1.Next;
end;
except
on E : Exception do
ShowMessage(E.Message);
end;
end;
RRUZ
2010-09-26 00:34:55
+1 for a "out-of-the-box" Delphi solution
Marjan Venema
2010-09-26 07:50:36
This just works for my purpose
eKek0
2010-09-27 00:30:10
I used this one, but migrated to TDBF, mainly because of speed reasons. Despite having bought Apollo
Marco van de Voort
2010-09-27 12:29:25