简体   繁体   English

LINQ to Entities无法识别方法'System.String Concat(System.Object)'方法,

[英]LINQ to Entities does not recognize the method 'System.String Concat(System.Object)' method,

I am getting LINQ to Entities does not recognize the method 'System.String Concat(System.Object)' method, and this method cannot be translated into a store expression. 我将LINQ to Entities does not recognize the method 'System.String Concat(System.Object)' method, and this method cannot be translated into a store expression. error when I am trying to concatenate number with string in LINQ? 我在LINQ中尝试用字符串连接数字时出错? how to resolve this? 该如何解决呢?

     Dim initiativeDataList As IEnumerable(Of InitiativeData) = 
         SGAEntities.Fact_Initiative.Where(Function(factInitiative) factInitiative.Client_Idx = client_Idx).[Select](
             Function(factInitiative) New InitiativeData() With { _
                         .ClientIdx = factInitiative.Client_Idx,
                         .HierarchyIdx = factInitiative.Hierarchy_Idx,
                         .CostCenterIdx = factInitiative.Cost_Center_Idx,
                         .LocationIdx = factInitiative.Location_Idx,
                         .InitiativeIdx = factInitiative.Initiative_Id,
                         ....
                         ....
                        .Location = String.Concat(factInitiative.Location_Idx) + ";" + factInitiative.Dim_Location.Location_Name,
             }).ToList()

你可以做

SqlFunctions.StringConvert((double)factInitiative.Location_Idx) + ";" + factInitiative.Dim_Location.Location_Name

I think you can just concatenate strings with + . 我认为您可以使用+连接字符串。 If you were using Concat for an implicit string conversion, consider using SqlFunction.StringConvert 如果您使用Concat进行隐式字符串转换,请考虑使用SqlFunction.StringConvert

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 LINQ to Entities无法识别方法'System.Object Parse(System.Type,System.String)' - LINQ to Entities does not recognize the method 'System.Object Parse(System.Type, System.String)' LINQ to Entities 无法识别“System.Object get_Item(System.String)”方法 - LINQ to Entities does not recognize the method 'System.Object get_Item(System.String)' method LINQ to Entities无法识别方法'System.Object get_Item(System.String)' - LINQ to Entities does not recognize the method 'System.Object get_Item(System.String)' 错误:LINQ to Entities无法识别字符串转换时发生的方法'System.String ToString(System.Object)'方法 - Error: LINQ to Entities does not recognize the method 'System.String ToString(System.Object)' method occurs while string conversion LINQ to Entities 无法识别方法“System.Object get_Item(System.String)”方法无法转换为存储表达式 - LINQ to Entities does not recognize the method 'System.Object get_Item(System.String)' method cannot be translated into a store expression LINQ to Entities无法识别方法'System.String ToString(System.Object)'方法错误,且字段可为空 - LINQ to Entities does not recognize the method 'System.String ToString(System.Object)' method error occurs with nullable fields 执行查询:“ LINQ to Entitites无法识别方法'System.Object getItem(System.String)'” - Excuting query: “LINQ to Entitites does not recognize method 'System.Object getItem(System.String)'” LINQ to Entities 无法识别“System.String Decrypt(System.String, System.String)”方法 - LINQ to Entities does not recognize the method 'System.String Decrypt(System.String, System.String)' method LINQ to Entities无法识别方法'System.String getFullname(System.String,System.String)' - LINQ to Entities does not recognize the method 'System.String getFullname(System.String, System.String)' LINQ to Entities无法识别方法'System.String ToString()'方法++++++ - LINQ to Entities does not recognize the method 'System.String ToString()' method ++++++
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM