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 ...
随机推荐
- gulp实例
前端生产环境的简单部署http://ionichina.com/topic/558a1c1346cb5ff7268cee9d var gulp = require('gulp'); // 引入gulp ...
- java中反向转义org.apache.commons.lang3.StringEscapeUtils.unescapeJava
工具类中包含类反向转义的方法: eorderHistory.setSubPrintTemplates(StringEscapeUtils.unescapeJava(eorderHistory.getS ...
- oracle中merge into用法解析
merge into的形式: MERGE INTO [target-table] A USING [source-table sql] B ON([conditional expression] an ...
- USB学习笔记连载(十六):USB数字签名
转载:http://blog.chinaaet.com/crazybingo/p/34487 曾记得在最开始安装驱动程序的时候出现过这个错误....但是最近我在别的电脑安装的时候又不出现这个错误了.. ...
- Java Set List Map
对JAVA的集合的理解是想对于数组 数组是大小固定的,并且同一个数组只能存放类型一样的数据(基本类型/引用类型) JAVA集合可以存储和操作数目不固定的一组数据. 所有的JAVA集合都位于 java. ...
- (笔记)Mysql命令create:创建数据库
create命令用于创建数据库. create命令格式:create database <数据库名>; 注意:创建数据库之前要先连接Mysql服务器. 1) 建立一个名为xhkdb的数据库 ...
- 对C语言中指针的入门理解
通过一个例子引出对指针的概念理解 1,例子 #include<stdio.h> int main(void) { ; //小张的身高 ; //小李的身高 ; //小王的身高 int *xi ...
- 函数后面有个 const
错误场景:类中的重载函数 编译报错: 函数后面加了 const 就好了. 非静态成员函数后面加const(加到非成员函数或静态成员后面会产生编译错误), 表示成员函数隐含传入的this指针为 cons ...
- JDBC删除数据实例
在本教程将演示如何在JDBC应用程序中,删除数据库表中数据记录. 在执行以下示例之前,请确保您已经准备好以下操作: 具有数据库管理员权限,以在给定模式的数据库表中删除数据记录. 要执行以下示例,需要用 ...
- Eclipse JUnit简单示例
在本节中,我们将看到一个简单的JUnit例子. 先创建一个工程,名称为:CalculateTest,并在这个工程上点击右键,选择:Build Path -> Add Library -> ...