LINQ to Entities does not recognize the method 'Int32 Parse(System.String)' method when attempting to parse a column for inequality comparisons

后端 未结 7 1121
抹茶落季
抹茶落季 2020-12-09 15:55

I have following code in my page:

var myVar= Entity.SetName
                 .Where(p => int.Parse(p.ID) >= start &&
                  int.Pars         


        
7条回答
  •  臣服心动
    2020-12-09 16:36

    move the parse function out of linq expression.

    int id = int.Parse(p.ID);
    var myVar= Entity.SetName
    .Where(p => id >= start && id <= end);
    

提交回复
热议问题