Handling a DateTime DBNull
I have seen many, many versions of this on SO, but none of them seem to quite work for my needs. My data comes from a vendor database that allows null for DateTime fields. First I pull my data into a DataTable. using (SqlCommand cmd = new SqlCommand(sb.ToString(), conn)) using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(dt); } I am converting a DataTable to a List<> for processing. var equipment = from i in dt.AsEnumerable() select new Equipment() { Id = i.Field<string>("ID"), BeginDate = i.Field<DateTime>("BeginDate"), EndDate = i.Field<DateTime>("EndDate"), EstimatedLife = i