Page 1 of 1

Requesting the caption of a column

Posted: Fri 03 Mar 2006 13:09
by Oli21
Hello,

is it possible to retrieve the caption of a column?
i want to store some data in a stringgrid; the first row (a fixed one) should hold the data eg.:

select a.article, a.id, a.locked from xyz a

----------------------------
| article | id | locked |
---------------------------
| data... | ... | ... |
| | | |

and so on...
is it possible to do that? i didn't find any property/method to get the information on the current query.

Best regards,

Oliver

Posted: Fri 03 Mar 2006 13:42
by Challenger
Try to use the FieldName or DisplayName property of TField. For example:
Caption := OraQuery.Fields[0].FieldName.

Posted: Fri 03 Mar 2006 14:27
by Oli21
Hello,

there is no .Fieldname or .DisplayName
I'm using TSmartQuery to retrieve the data.

Code: Select all

tQryExpert->Fields->FieldByNumber(j)->AsString;
gives me only the query-result, not the caption of the column.
i'm using borland c++ 6

Best regards,

Oliver[/code]

Posted: Mon 06 Mar 2006 14:34
by Challenger
To get field name try to use the following code:

Code: Select all

IBCQuery1->Fields->FieldByNumber(j)->FieldName