Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using the result of a query. 1

Status
Not open for further replies.

terrytype

Programmer
Jun 1, 2011
97
ZA
I use Delphi6 Professional.

I have a query [qryDLTBError] in which the SQL code is
SELECT SUM (Balance)
FROM "c:\h\StdAcc\DL"

which produces 'SUM OF Balance'

I need [something like] "IF qryDLTBErrorSUM OF BALANCE <> 0 then
begin
do something;
end;

This obviously does not work.
What would be the appropriate code?


Old Man Delphi
 
Try something like that:

SQL code:

Code:
SELECT SUM (Balance) as sumofbalance
FROM "c:\h\StdAcc\DL"


Delphi code:

Code:
if qryDLTBError.FieldByName('sumofbalance').Value <> 0 then
begin
  // do something;
end;


I hope this helps.


Imoveis comerciais em Guarulhos
 
Thanks imex
You cannot possibly know how you have made the day of this old man!
How important that advice [which works [perfectly!] was to me.
Have a HUGE day!!

Old Man Delphi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top