hawkerpac
asked on
How to get a value from TADOQuery and assign to a text field.
I have a query in the TADOQuery
select sum(wr_run) as ActHrs from pub.wr_route where "wr_nbr" >= :nbr1
and wr_nbr <= :nbr2
Run time i want to assing the value Acthrs to a text field.
I have done the following
cop_qryactstd.Close;
cop_qryactstd.Parameters.P aramValues ['nbr1'] := cop_edtfwo1.Text;
cop_qryactstd.Parameters.P aramValues ['nbr2'] := cop_edttwo1.Text;
cop_qryactstd.Open;
Now how to assign the value to the text field.
Thanks in advace for the help.
select sum(wr_run) as ActHrs from pub.wr_route where "wr_nbr" >= :nbr1
and wr_nbr <= :nbr2
Run time i want to assing the value Acthrs to a text field.
I have done the following
cop_qryactstd.Close;
cop_qryactstd.Parameters.P
cop_qryactstd.Parameters.P
cop_qryactstd.Open;
Now how to assign the value to the text field.
Thanks in advace for the help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Also you can format the returned figure for arithmetic precision:
...
cop_qryactstd.Close;
cop_qryactstd.Parameters.ParamValues['nbr1'] := cop_edtfwo1.Text;
cop_qryactstd.Parameters.ParamValues['nbr2'] := cop_edttwo1.Text;
cop_qryactstd.Open;
Edit1.Text := Format('%0.2n', [cop_qryactstd.FieldByName('ActHrs').AsFloat]); // for 2 decimal places
...
ASKER
Thanks for the help. Worked.
Open in new window