'Date' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported

后端 未结 8 497
粉色の甜心
粉色の甜心 2020-11-27 05:57

I am trying to execute the following code and am receiving an error

public List GetLoggingData(DateTime LogDate, string title)
{
     var context          


        
相关标签:
8条回答
  • 2020-11-27 06:25

    Convert LongDate to .ToShortDateStringand then you can use it this way:

    EntityFunctions.TruncateTime(t.Timestamp) == LogDate
    

    like mike did

    0 讨论(0)
  • 2020-11-27 06:33

    Try this:

    var calDate = DateTime.Now.Date.AddDays(-90);
    
    var result = return (from r in xyz where DbFunctions.TruncateTime(r.savedDate) >= DbFunctions.TruncateTime(calDate)
    
    0 讨论(0)
提交回复
热议问题