Hi
System.Nullable<DateTime> DateToSelect = (from p in db.Archived select p.TestDate).Max();
I'm trign to return a date from a table but if there are no records in the table i get the Error
The null value cannot be assigned to a member with type System.DateTime which is a non-nullable value type.
How do i stop this null error if there are no records matching the criteria
I also have the problem when there are records in the table and i place a where statement in the LINQ i get the same error even if there are records that meet the criteria.
e.g.
System.Nullable<DateTime> WinningDateToSelect = (from p in db.qtxt_Competitions_Archived_Winners where p.ID = 1 select p.WinningDate).Max();
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.