'Could not convert variant of type (Null) into type (Double)'

3
if DataModuleGeral.tbHonorariosPERCENT_ADV_ASSIST1.AsFloat = 0 then
begin
  DataModuleGeral.tbHonorariosPERCENT_ADV_ASSIST1.Value := Null;
end;

I have the above routine that when the percentage caligo is 0 I try to set the field to Null so that in the database I do not have the field blank ... In Delphi 7 works fine and now in Delphi 10.1 it is not working ... Anyone know how to solve it?

    
asked by anonymous 15.08.2017 / 14:40

1 answer

4

In assigning null I have also had problems using Value , so I use AsVariant like this:

DataModuleGeral.tbHonorariosPERCENT_ADV_ASSIST1.AsVariant:= Null;
    
15.08.2017 / 15:54