In the database Postgresql, I defined the field as:
ball numeric not null,
When one register, have value '0' (zero), the property asString return a empty string,
instead of returning a string with value '0'.
In the component TSqlQuery, when try access the valor as String, so:
var
ball: string;
begin
sqlRegister := TSqlQuery.Create;
...
ball := sqlRegister.FieldByName('ball').asString,
asString, returned a empty string instead of a string with value zero.
I know I should use AsInteger because the value of the field in the table is numeric, however, I am populating the data in a STRINGGRID.
However, I found that the behavior of asString was to convert the value zero to a string with the value zero, however, it converts with an empty string, behaving as if the field 'ball' had a null value, which is not correct in this case.
The Workaround who I did was:
ball := IntToStr(sqlRegister.FieldByName('ball').asInteger);
My question is, Why asString should not return an empty string instead of the value '0', when the value of the register field is 0???