procedure TForm1.TotalPopulation: double;
var
Tbl: TTable;
begin
Result := 0;
Tbl := TTable.Create(nil);
try
tbl.DatabaseName := 'DBDEMOS';
tbl.TableName := 'COUNTRY';
Tbl.Open;
tbl.First;
while not Tbl.EOF do
begin
Result := Result + Tbl.FieldByName('Population').AsFloat;
Tbl.Next;
end;
Tbl.Close;
finally
Tbl.Free;
end;
end;
|