Hi.
I'm newer with zeos in lazarus and firebird.
I've a table with a numeric (decial, float, double ...) field. I post into it a value less than 10 with a 2 (or more) decimals (p.e. 5.92) and the value is posted right in the table, but the control (aka TDBEdit, TDBGrid) doesn't reflect the correct value, it shows the value without last decimal. (p.e 5.92 -> 5.9). That doesn't occurr with values greater than or equal to 10.
I know I can play with precission in the field definition, but I'm developing a Database administration utility, and I open the tables dinamically.
Is that a bug? zeos 7 alpha has the same behavior than 6.6 stable.
What can i do to solve it ?
SQLdb works properly.
Thanks, regards from Spain.
(excuse my english)
Zeos + Lazarus + Firebird - Numbers < 10 with 2 decimals
Moderators: gto, EgonHugeist
-
- Senior Boarder
- Posts: 93
- Joined: 01.07.2009, 16:07
-
- Senior Boarder
- Posts: 93
- Joined: 01.07.2009, 16:07
I think you can change these properties dynamically after creating the components.
var
i: integer;
with TZTable.create do
begin
Connection := 'YourZConnection';
TableName := 'YourTable';
open;
for i := 0 to FieldCount-1 do
begin
if Fields.FieldKind = fkData then if Fields.DataType =ftFloat then
TFloatField(Fields).DisplayFormat := '0000.000';
end;
end;
Guido
var
i: integer;
with TZTable.create do
begin
Connection := 'YourZConnection';
TableName := 'YourTable';
open;
for i := 0 to FieldCount-1 do
begin
if Fields.FieldKind = fkData then if Fields.DataType =ftFloat then
TFloatField(Fields).DisplayFormat := '0000.000';
end;
end;
Guido
Thanks, Guido, for your response. That is not exactly I'm looking for, but is a good porvisional solution.
However, this would be the right DisplayFormat: '0.00'. Only one zero in the left side and the required zeros in the right side. Also we can use the format char '#' to specify optionals spaces for decimals.
Example:
(0.00 ) 5.923 -> 5.92 , 8.6 -> 8.60
(0.0##) 5.923 -> 5.923, 8.6 -> 8.6
Thanks again.
However, this would be the right DisplayFormat: '0.00'. Only one zero in the left side and the required zeros in the right side. Also we can use the format char '#' to specify optionals spaces for decimals.
Example:
(0.00 ) 5.923 -> 5.92 , 8.6 -> 8.60
(0.0##) 5.923 -> 5.923, 8.6 -> 8.6
Thanks again.