I recently changed my code to directly use a DataSet query to load values to a class because it is faster than using TObjectManager and I needed more performance. Talking about an object list of many thousands of items.
But now when I try to assign a null value to a Nullable property I get an exception.
Example:
TMyClass = class
myproperty1: Nullable;
myproperty2: Nullable;
myproperty3: Nullable;
end;
and trying this gives me the exception:
myClass.myproperty1 := myDataSet.FindField('somefield').AsVariant;
myClass.myproperty2 := myDataSet.FindField('somefield').AsVariant;
myClass.myproperty3 := myDataSet.FindField('somefield').AsVariant;
if the dataset field is null, I get an exception.
What can I do to fix this?
Thanks.