I have an Aggregate field in a client data set and I use a function to get the aggregate value, if the client data set is empty the function should return 0.
if I do this:
if MyClientDataSet.AggregateField.IsNull then
Result := 0
else
Result := MyClientDataSet.AggregateField.Value;
when the client data set is empty the else part is executed and raise an exception (cannot convert Variant to Currency error).
But if I do it this way
if MyClientDataSet.AggregateField.Value = Null then
Result := 0
else
Result := MyClientDataSet.AggregateField.Value;
it works fine!
So my question is: What's the difference between the IsNull property and comparing the Value property with the Null Value, In a TAggregateField?