Write null DateTime field in Access database (mdb)

0

Good afternoon everyone.

Please, I need your help.

I'm trying to write / update a Birth field of type DateTime, but this field will not always be filled, due to the business rule sometimes it will be null.

The base used is the Access mdb format.

At the time of recording / updating I can not, see how I'm doing.:

Example:

public DateTime? Nascimento { get; set; }

cmdInsercao.Parameters.AddWithValue("@NASCIMENTO", Cli.Nascimento);

I tried this:

cmdInsercao.Parameters.AddWithValue("@NASCIMENTO", Cli.Nascimento == null ? (object)DBNull.Value : Cli.Nascimento);

and nothing ....

DBNull.Value did not roll either ..

Someone has a solution

Thank you

    
asked by anonymous 18.08.2016 / 20:28

0 answers