In a database, there is a field that saves a closure date. This date can be NOT NULL only if the case has been closed. If the case is not closed, it has to be NULL. How can I pass null value to a DateTime object?
Tried this but it doesn't work.
DateTime closure= dateDatumIspisa.SelectedDate ?? null;
DateTime closure= dateDatumIspisa.SelectedDate ?? DateTime.Parse("");
DateTime closure= dateDatumIspisa.SelectedDate ?? DBNull.Value;
DateTime closure= dateDatumIspisa.SelectedDate ?? DateTime.Parse(DBNull.Value.ToString());
Also tried GetValueOrDefault() but it inserts DateTime.Min value, while I need this field left empty.
Any suggestions?