Interview Questions

How is OnCalcFields event handler used in Delphi?

Delphi Interview Questions


(Continued from previous question...)

How is OnCalcFields event handler used in Delphi?

OnCalculate is event in Delphi it trigerrs when you are reading data from the database .

NOTE : It trigerrs on reading each row
Stupid Example :
if you want to subtract two coolumns from database table then you override this event with

procedure TForm1.ADOQuery1CalcFields(DataSet: TDataSet);
begin
Variable_b=adoQuery1.fieldByname('Name_Of_the_DbColumn1').asfloat +adoQuery1.fieldByname('Name_Of_the_DbColumn2').asfloat;

Showmessage(floattostr(Variable_b));
end;

(Continued on next question...)

Other Interview Questions