Reputation: 969
I am writing a select query in lambda expression in which one of the column name (ResolveDate
) is null, and I am getting the following error:
The 'ResolveDate' property on 'Ticket' could not be set to a 'null' value. You must set this property to a non-null value of type 'System.DateTime'.
How can I set this column nullable? I mean that if column is null in my query result it should not give error?
Upvotes: 3
Views: 12029
Reputation: 3304
DateTime is a reference type. You need to use Nullable DateTime in your class.
DateTime? ResolveDate = null;
or
Nullable<DateTime> ResolveDate ;
Upvotes: 8