[Lazarus] Is anyone working with the simple datasets?
Graeme Geldenhuys
graemeg.lists at gmail.com
Mon Apr 14 09:46:23 CEST 2008
Felipe Monteiro de Carvalho wrote:
> datasets so I am curious to know if anyone is using the simple
> datasets with FPC 2.2.0 (TMemDataset, TFixedFormatDataset, TDBf).
I also struggled in the beginning with DB components in Lazarus and
found some strange properties which could clash (message thread of about
two or three months ago). fpGUI has a TDBF example in the
examples/gui/dbtest/ directory, if that might help.
http://fpgui.svn.sourceforge.net/viewvc/fpgui/trunk/examples/gui/dbtest/
------------[ snippet ]-------------------
constructor TMainForm.Create(AOwner: TComponent);
var
x: Integer;
s: string;
begin
inherited Create(AOwner);
DataSet := TDBF.Create(Self);
DataSet.TableName := 'test.dbf';
DataSource := TDataSource.Create(Self);
DataSource.DataSet := DataSet;
dblblName.DataSource := DataSource;
dblblName.DataField := 'Name';
dblblEMail.DataSource := DataSource;
dblblEMail.DataField := 'Address';
DataSet.Open;
while not DataSet.EOF do
begin
SetLength(s, 0);
for x := 0 to DataSet.FieldCount - 2 do
s := s + DataSet.Fields[x].AsString + ', ';
s := s + DataSet.Fields[DataSet.FieldCount - 1].AsString;
lstName1.Items.Add(s);
DataSet.Next;
end;
DataSet.First;
end;
------------[ end ]--------------------
Regards,
- Graeme -
_______________________________________________________
fpGUI - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/
More information about the Lazarus
mailing list