在uses单元加入Variants!
VarType function from Variants unit in Delphi 7
In Delphi 5, VarType function is declared in Systems unit. In Delphi 7, it is moved to Variants unit.
Declaration: property Values[const name: String]: Variant
My problem is the statement Values['fieldname']:= 0 gives problem and the statement Values['fieldname']:= StrToInt('0') seems to work.
The field in the table is an integer field.
The same thing happens with a float field, the statement Values['fieldname']:= 1 gives problem and the statement Values['fieldname']:= StrToFloat('1') seems to work.
Does the Variant need to be "informed" what datatype it is with the help of functions like StrToInt and StrToFloat?
Declaration: property Values[const name: String]: Variant
My problem is the statement Values['fieldname']:= 0 gives problem and the statement Values['fieldname']:= StrToInt('0') seems to work.
The field in the table is an integer field.
The same thing happens with a float field, the statement Values['fieldname']:= 1 gives problem and the statement Values['fieldname']:= StrToFloat('1') seems to work.
Does the Variant need to be "informed" what datatype it is with the help of functions like StrToInt and StrToFloat?