Use Linq query to compare date only with DateTime field

后端 未结 7 1209
孤城傲影
孤城傲影 2020-12-20 14:59

I need to compare just the date only in a Linq query that involves a datetime field. However, the syntax below results in the following error message

<

相关标签:
7条回答
  • 2020-12-20 15:40

    Take off the .Date If the field is a DateTime it can be compared with ==

    var duplicate = from a in _db.AgentProductTraining
                    where a.CourseCode == course.CourseCode &&
                    a.DateTaken == course.DateTaken &&
                    a.SymNumber == symNumber
                    select a;
    
    0 讨论(0)
提交回复
热议问题