Hi!
I am migrating some IBX/Firebird code to ZEOS/Firebird (in Delphi 2009) and I have met strange issue: I have simple ZQuery with ZUpdateSQL and ZQuery has some calculated fields and one editable field. When I am opening query then calculated fields are calculated without problems. But when I am changing the value of the editable field then the error message is raised "Field XXX cannot be modified" upon first assignment in OnCalc event handler. Is this by design? What I am doing wrong?
TZQuery is very similar to TQuery (BDE) and TQuery allows to have calculated and editable fields in the same query.
(Caluclated) "Field XXX cannot be modified" in ZQuery OnCalc event?
-
- Platinum Boarder
- Posts: 1956
- Joined: 17.01.2011, 14:17
Re: (Caluclated) "Field XXX cannot be modified" in ZQuery OnCalc event?
Hello tomr,
this is expected behaviour, if you select the calculated fields in a query like this:
If your code is like this, and you don't use TZUpdateSQL, then c will be a read only data field. If I understand correctly what you do you need to select the data without c and then add a field of the kind fkCalculated to the TZQuery on the Delphi side. I would assume that things also work like this in IBX? OnCalcFields is only to be used for fields of kind fkCalculated and not for fields of kind fkData.
With best regards,
Jan
this is expected behaviour, if you select the calculated fields in a query like this:
Code: Select all
select a, b, a+b as c from mytable
With best regards,
Jan