Read an entity (HasValue or not)

Hello,


I get an entity Person and want to assign the fields to some edits.

Edit1.Text := Person.Number; // nullable String-Field

If "HasValue" is false (NULL data in DB), I get an exception.

So I must write 

If Person.Number.HasValue then Edit1.Text := Person.Number;

This is laborious. Is this the only way?

Hi Thomas,

You can use ValueOrDefault:


Edit.Text := Person.Number.ValueOrDefault;


great, thank you