LINQ to Entities does not recognize the method 'Int32 ToInt32(System.String)' method, and this method cannot be translated into a store expression
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的更多相关文章
- LINQ to Entities 不识别方法“Int32 ToInt32(System.String)”,因此该方法无法转换为存储表达式。
通常原始代码如下: Where id=Convert.ToInt32(cousid) 更改后代码: Var currentid= Convert.ToInt32(cousid); Wehre id ...
- mvc ef LINQ to Entities 不识别方法“Int32 Parse(System.String)”,因此该方法无法转换为存储表达式。
private sys_User GetUserInfo() { sys_User model = null; var userId = Convert.ToInt32(AccountHelper.G ...
- 关于.ToList(): LINQ to Entities does not recognize the method ‘xxx’ method, and this method cannot be translated into a store expression.
LINQ to Entities works by translating LINQ queries to SQL queries, then executing the resulting quer ...
- 报错:System.NotSupportedException: LINQ to Entities does not recognize the method
报错:System.NotSupportedException: LINQ to Entities does not recognize the method ...... get_Item(Int3 ...
- LINQ to Entities does not recognize the method , and this method cannot be translated into a store expression 解决办法
根据用户输入的起始日期,查询以起始日期开始的前20条记录,在ASP.NET MVC的Controller代码中这样写: var Logs = db.Log.Take(20); if (!string. ...
- LINQ to Entities does not recognize the method 'System.DateTime AddDays(Double)' method, and this method cannot be translated into a store expression.
NormalSubmission=analysis.Count(x=>x.FinishTime<= endTime.AddDays(1))报错linq不能识别 => var endT ...
- LINQ to Entities does not recognize the method 'System.DateTime ToDateTime(System.String)' method
System.Data.Objects.EntityFunctions和System.Data.Objects.SqlClient.SqlFunctions中的方法进行比较,如下 where Syst ...
- 报错: LINQ to Entities 不识别方法“Int32 Parse(System.String)
断点调试发现报错的语句为: public ActionResult SomeMethod(string someId) { var temp = SomeService.LoadEntities(a ...
- LINQ to Entities不支持Convert.ToDateTime方法解決一例
錯誤提示: LINQ to Entities does not recognize the method 'System.DateTime ToDateTime(System.String)' met ...
随机推荐
- sql临时表,表变量,CTE,游标使用方法
if OBJECT_ID('groups') is not null drop table groups create table groups ( groupid ), val int null ) ...
- java transient关键字作用,使用场景。
java transient关键字作用,使用场景. 2016年08月31日 15:31:10 阅读数:4280 transient的作用及使用方法,官方解释为: Variables may be ma ...
- Java设计模式(4)原型模式(Prototype模式)
Prototype模式定义:用原型实例指定创建对象的种类,并且通过拷贝这些原型创建新的对象. Prototype模式允许一个对象再创建另外一个可定制的对象,根本无需知道任何如何创建的细节,工作原理是: ...
- 扫描二维码或其他操作情况下返回界面,onActivityResult()不执行的问题
在使用第三方zxing扫描时,部分手机(好像都是4.4及以下版本的手机)扫描后不调用onActivityResult()返回结果. 调试发现zxing的扫描界面CaptureActivity 在注册时 ...
- R语言使用tryCatch进行简单的错误处理
最近在看<机器学习:实用案例解析>,做邮件过滤器的时候,参考书中的代码读取邮件文件进行分类器训练,在读取过程中会出现下面的错误: seq.default(which(text == & ...
- Sword redis补充
Redis 键(key) Redis 键命令用于管理 redis 的键. redis任何数据类型都有key --删除key的命令 redis> del key Redis 事务 Redis 事务 ...
- Linux 系统服务注册
Linux注册系统服务步骤 1.编写服务脚本 2.拷贝到/etc/init.d目录下 3.为服务脚本添加可执行权限 >>chmod a+x xxxd 4.添加到系统服务中 ...
- 遍历QMap引发异常处理
引言 用常规方法遍历QMap,删除满足条件元素时出现“读取位置0xXXX时发生访问冲突”.查看“调用堆栈”指向QMap<int,int>::iterator::operator++()和Q ...
- (笔记)Mysql命令grant on:增加新用户并控制其权限
grant on命令用于增加新用户并控制其权限. grant on命令格式:grant select on 数据库.* to 用户名@登录主机 identified by “密码”; 1) 增加一个用 ...
- 114ic电子元器件网
http://www.114ic.cn/datasheet-pdf/TPA0211DGN-163932.html