码迷,mamicode.com
首页 > 其他好文 > 详细

LINQ to Entities does not recognize the method 'Int32 ToInt32(System.String)' method, and this method cannot be translated into a store expression

时间:2018-11-27 19:42:06      阅读:203      评论:0      收藏:0      [点我收藏+]

标签:expr   The   rem   typeid   arm   sla   ssi   解决   exp   

if (!string.IsNullOrEmpty(FarmWorkId))
{
data = data.Where(p => p.TypeId == Convert.ToInt32(FarmWorkId));
}

 

解决方法:

if (!string.IsNullOrEmpty(FarmWorkId))
{
int i = Convert.ToInt32(FarmWorkId);
data = data.Where(p => p.TypeId == i);
}

LINQ to Entities does not recognize the method 'Int32 ToInt32(System.String)' method, and this method cannot be translated into a store expression

标签:expr   The   rem   typeid   arm   sla   ssi   解决   exp   

原文地址:https://www.cnblogs.com/siyunianhua/p/10027886.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!