I am bringing several records from a database to a database datatable
and I have 4 fields that are of type date. At least one of them could bring a value NULL
and when linking the field with a control datetimepicker
it gives me an error not finding a valid value.
How could I pre-validate the field before assigning it to the control? I have tried comparing the value
field with NULL
but it has not worked.
if (campoFecha != null)
The Date field already has the value fetched by it datatable
and has been declared asdatetime
You have to use the
DbNull.Value
to validate if it is null from the db