I have a DateTime value that I will like to save to the database. The column allows null
in the database. When I try to run the code below I get this error message.
Type of conditional expression cannot be determined because there is no implicit conversion between system.dbnull and system.datetime
How can I store null or empty value for a date column?
public class ExcelData
{
public DateTime? DateValue1 { get; set; }
}
DateValue1 = col28Value == null ? DBNull.Value : Convert.ToDateTime(col28Value)
col28Value?