Board index » delphi » Adding numbers in the DBGrid-component ?

Adding numbers in the DBGrid-component ?

Hi!
Does anyone know how to add the numbers in a single column in the DBGrid -
component (not knowing how many records there will be of course) ?
-GE-
 

Re:Adding numbers in the DBGrid-component ?


You can do another query (bad) or you can loop thru the dataset, after
disabling visual controls (much better).

like

query.first;
total := 0;
if not query.isempty  (I think it's isempty - check it out)
while not query.eof do
begin
  total := total + fieldbyname('field').assomething;
  query.next;
end;

basically the same thing can be done with ttable.

Robert

Quote
Geir wrote in message <72kjm1$pp...@readme.online.no>...
>Hi!
>Does anyone know how to add the numbers in a single column in the DBGrid -
>component (not knowing how many records there will be of course) ?
>-GE-

Other Threads