none
DateTime parsing Exception in Linq query RRS feed

  • Question

  • I have a simple entity which is

    public partial class Medium {
        public int Id {get; set;}
        public DateTime Date {get; set;}
    }

    and the following query

    from element in db.mediums select element

    I also have valid data in my database (the Date property in each entry is set with the DateTime.Parse() method). However, executing the query gives the exception.

    "Cannot set the property Date to a System.String value, you must set it to a non null value of System.DateTime".

    I sincerely can't understand what is going on, I thought DateTime was supported by EF.




    • Edited by T.Ajileye Thursday, October 29, 2015 12:09 AM
    Wednesday, October 28, 2015 9:46 PM

All replies

  • Hello,

    >>I sincerely can't understand what is going on, I thought DateTime was supported by EF

    I could confirm DateTime is supported by EF and I've used this type in several projects.

    >>"Cannot set the property Date to a System.String value, you must set it to a non null value of System.DateTime".

    Could you please provide steps for reproduce this issue? I hope you can post a sample to your OneDrive and share a link here. I would like to troubleshoot and let you know my result.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, November 4, 2015 3:31 AM
    Moderator