4
I want to conduct a search in a query
So far I have only been able to display the total value of the records.
the idea is to show the spending average.
Then it would be the (total / quantity) however I could not mount the logic:
what I have so far presented the Count of all records
with AdoMEdOs do
begin
Close;
Sql.clear;
AdoMEdOs.SQL.Add('select valor_total from ordem_servico');
open;
RecordCount;
label5.Caption := IntToStr(AdoMEdOs.RecordCount) ;
AdoMEdOs.Close;
end;
label5.Caption := Inttostr(Adomedos.Recordcount) ; ?
– Guilherme Lima
@Guilhermelima, I changed the answer giving a name to the field, called media. Now you will use your bank access component, Adomedos, to get the value of the media field.
– cantoni
Pretty much what I needed !
– Guilherme Lima
made the query in sql and it returns me the value 24 and in Delphi returns me the value of 0 in the label.
– Guilherme Lima
@Guilhermelima, I haven’t dealt with Delphi for a long time. It’s certainly something you’re getting wrong. How you get the value of a field with this Fear component?
– cantoni
label5.Caption := Fieldbyname('media'). Asstring; Presented the value now, it was a mistake anyway.. thanks for the help.
– Guilherme Lima