NewToProgramming
Technical User
My Query rounds off numbers, but I don't want it to.
How do you stop that from happening?
Here is my code:
Query := TQuery.Create( nil );
I := 1;
R := 0;
Query.DataBaseName := Table1.DataBaseName;
Query.SQL.Add( 'SELECT (field) as whatever from db.Db' );
try
Query.Open;
Query.First;
while not Query.Eof and (i<=10) do
begin
R := R + Query.FieldByName('Whatever').AsInteger ;
Query.Next;
Inc(i);
Form3.Edit1.Text := FormatFloat(FormatSpec, R div 10);
end;
finally
Query.Free;
end;
Result := True;
end;
How do you stop that from happening?
Here is my code:
Query := TQuery.Create( nil );
I := 1;
R := 0;
Query.DataBaseName := Table1.DataBaseName;
Query.SQL.Add( 'SELECT (field) as whatever from db.Db' );
try
Query.Open;
Query.First;
while not Query.Eof and (i<=10) do
begin
R := R + Query.FieldByName('Whatever').AsInteger ;
Query.Next;
Inc(i);
Form3.Edit1.Text := FormatFloat(FormatSpec, R div 10);
end;
finally
Query.Free;
end;
Result := True;
end;