[Lazarus] RE : How to get field-names of a table ?

Koenraad Lelong lazarus1 at de-brouwerij.be
Mon Jan 9 15:39:45 CET 2012


On 06-01-12 17:19, Ludo Brands wrote:
> designer then just add a
>    SQLQuery1.Active:=true;

> before the above loop to auto fill the fielddefs. For this to work, as for
> fields, Fielddefs should be an empty array. As soon on element is in
> fielddefs, the auto fill won't work.
>

Hi,

Thanks Ludo, opening the query auto-filled the fielddefs, if there were 
no manually created fielddefs.

Now I have to give each field an onGetText event. I was looking for some 
documents, but I seem unable to find something. Any help ?
I tried several things but only this compiles, and it even works :
for i:=0 to MyQuery.FieldDefs.Count-1 do
  MyQuery.Fields.Fields[i].OnGetText:=@MyQueryDATAGetText;

I created MyQueryDATAGetText by manually creating a field, creating 
onGetText by double-clicking on it and putting my code in it.
Afterwards I deleted the field.

Is this OK ? To me it seems a hack.

Thanks.

Regards,

Koenraad Lelong




More information about the Lazarus mailing list