No if you need an new field, use a calcfield. Add this doble click on tsqlobject, new field, put name, in oncalcfield event fill this with anythinks Enviado desde mi BlackBerry
-----Original Message----- From: Koenraad Lelong <[email protected]> Date: Fri, 06 Jan 2012 15:31:17 To: <[email protected]> Reply-To: Lazarus mailing list <[email protected]> Subject: Re: [Lazarus] How to get field-names of a table ? 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. -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
