i have the following code:
var distinctRows =
(from row in ds.GetTable(this.TagShortName).AsEnumerable()
select new Audit
{
ID =row.Field<long>("ID"),
UpdatedBy =string.Format("{0} {1}",
row.Field<string>("UpdatedByFirstName"),
row.Field<string>("UpdatedByLastName")),
UpdatedOn = ow.Field<DateTime>("UpdatedOn")
}).Distinct(new AuditComparer());
when i have null value in UpdateOn field it throw exception on:
UpdatedOn =row.Field<DateTime>("UpdatedOn")
exception: Cannot cast DBNull.Value to type 'System.DateTime'. Please use a nullable type.
how to handle this?
UpdatedOndatatype you will need that to beDateTime?