[Lazarus] How to get field-names of a table ?
Koenraad Lelong
lazarus1 at de-brouwerij.be
Fri Jan 6 15:31:17 CET 2012
On 06-01-12 01:20, Maximiliano Duarte wrote:
> When you open the query you object is deleted.
> If yuo need only a field name is
>
> Query1.sql.text:= "select * from mytable";
> Query1.open;
> Name:=Query1.Fields[0].fieldname;
>
Thanks for your response, but it does not work.
The table I use has more than five fields. I manually created one field
(double clicking the sqlQuery and adding one field).
When I run the program, I display Query1.FieldCount : 1.
When I try to display Query1.Fields[1].fieldname ([1], i.e. the second
fieldname) I get an "list index out of bounds" error.
Displaying Query1.Fields[0].fieldname gives the fieldname of the field I
manually created.
So is there a way to what Lazarus can do (adding fields) by using the
properties and/or methods of a TSQLQuery, or another component ?
Thanks for any help,
Koenraad Lelong.
More information about the Lazarus
mailing list