Don't know how to handle 'Nullable' error

When I retrieve data from the database with Aurelius, one of the columns keeps giving me this error:

exception class ENullConvertException<System.Integer> with message 'Nullable: Cannot convert SNull into Integer.'.

Everything I try to avoid a NULL value in a variant fails here, including setting the global value 'NullStrictConvert:=False;'.
What can I do to avoid this error?

Hi Ronald, what is your mapping, what is the data in database that is causing the problem and what is the exact code that raises the error?

Hi Wagner,
In Aurelius the mapping is:

    [Column('laatsteloggingid', [])]
    Flaatsteloggingid: Nullable<Integer>;

In the database there is an integer column in PostgreSQL, nothing special:

laatsteloggingid integer

In the code I get some data from the database like this:

servers   := OM.Find<Tservers>.List;

The error occurs when I do this:


The error only occurs when the field is not 0, but NULL. It will get this value in PostgreSQL when it's not filled witrh a value.

You can use nLaatsteLoggingId := Servers[nTeller].LaatsteLoggingId.ValueOrDefault

It will return 0 if the field is NULL

There you go Roland, thanks Kick for collaboration.

Thank you!