'Could not Convert Variant of type (Null) into type (Double)'

Asked

Viewed 976 times

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 cap is 0 I try to set the field to Null so that in the database do not keep the field blank... In the Delphi 7 works perfect and now in Delphi 10.1 is not working... Does anyone know how to solve?

1 answer

4


In the assignment of null I’ve had trouble using the Value, then use the AsVariant thus:

DataModuleGeral.tbHonorariosPERCENT_ADV_ASSIST1.AsVariant:= Null;
  • Um... I’ll try not to have to think about it.

  • 1

    Functional Mayor. Thanks man!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.