Think I figured it out If I cast the maximum note value to a nullable DateTime it seems to eliminate the exception. The following change worked for me: LastNote = (Nullable)contact.Notes. Max(n => n.
Created) As others have pointed out, it can also be written using the shorthand notation for a nullable DateTime as follows: LastNote = (DateTime? ) contact.Notes. Max(n => n.
Created).
Think I figured it out. If I cast the maximum note value to a nullable DateTime it seems to eliminate the exception. The following change worked for me: LastNote = (Nullable)contact.Notes.
Max(n => n. Created) As others have pointed out, it can also be written using the shorthand notation for a nullable DateTime as follows: LastNote = (DateTime? ) contact.Notes.
Max(n => n. Created).
Is equivalent to Nullable (see Keltex's post) – Adam Robinson Apr 22 '09 at 3:30.
You could do that, or you could alter your database schema so that the column 'Created' does not allow nulls. The scenario is arising because one of the rows comes back with a null value for Created. If the db didn't allow nulls, the scenario would never occur.
You'd still get a null back from the call to Max if the contact didn't ever create any notes. – Matt Hamilton Apr 22 '09 at 2:49 This suggestion is not valid. There is always the opportunity to have a null DateTime.
I have worked with several db's now that have a DT field, such as 'closing_date'...no closing date has been applied yet, therefore, null. – IAbstract Dec 22 '10 at 19:40.
LastNote = contact.Notes. Max(n => (DateTime? )n.
Created) Couldn't find this on the net so I hope this helps others.
In VB is something like: LastNote = CType(contact.Notes. Max(n => n. Created), Global.System.
Nullable(Of Date)) I think...
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.