Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/286.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 为什么可以';使用SqlFunctions在LinQ中将int转换为字符串?_C#_Linq_Entity Framework_Sql Server Ce - Fatal编程技术网

C# 为什么可以';使用SqlFunctions在LinQ中将int转换为字符串?

C# 为什么可以';使用SqlFunctions在LinQ中将int转换为字符串?,c#,linq,entity-framework,sql-server-ce,C#,Linq,Entity Framework,Sql Server Ce,为什么这Linq不起作用 Groups.Where(x => SqlFunctions.StringConvert((double?)x.Code) .Trim().StartsWith(txtSearch.Text)) .ToList(); 错误 The specified method 'System.String StringConvert(System.Nullable`1[System.Double])'

为什么这
Linq
不起作用

Groups.Where(x => SqlFunctions.StringConvert((double?)x.Code)
                              .Trim().StartsWith(txtSearch.Text))
      .ToList(); 
错误

The specified method 'System.String StringConvert(System.Nullable`1[System.Double])' on the type 'System.Data.Entity.SqlServer.SqlFunctions' cannot be translated into a LINQ to Entities store expression.
我使用的是EF6/sqlce/C#


代码是一个int字段

您应该使用SqlceFunctions而不是SqlFunctions

所以你的代码应该是

  Groups.Where(x =>  SqlCeFunctions.StringConvert ((double?) x.Code)
                                   .TrimStart() .StartsWith(txtSearch.Text))
        .ToList();

名称空间:System.Data.Entity.SqlServerCompact

你能说得更具体些吗?什么是异常/错误?什么是异常/编译器错误?什么是组及其代码属性?代码是一个Int字段,组是一个实体列表