I have a TUniQuery in Delphi, using the DevArt component.
This works fine, and I can assign values using syntax like qry1.Fields[1].AsString
.
But to avoid absolute indexing of database fields I would like to work with field names instead. After doing some research on forums, I found that the following works as well: qry.fieldbyname('fieldname').AsString
.
Unfortunately, as DevArt documentation states : "It publishes most of its inherited properties" (my enhancement). FieldByName is one of the unpublished properties.
In the code I can write qry.parent.fieldbyname('fieldname').AsString
which works, but I would like to avoid what I see as a "hack".
So, as TCustomUniDataSet is the parent of TUniQuery, how do I get to work with it, and the recordset of TQuery ? Devart does recommend working with TUniquery, but what is then my way forward for non-published properties ?
Applications should never use TCustomUniDataSet objects directly. Instead of TCustomUniDataSet, they should use TCustomUniDataSet descendants, such as TUniQuery and TUniTable, which inherit its dataset-related properties and methods.