LINQ to Entities不能识别'System方法.字符串Concat (System.Object)
本文关键字:System 字符串 方法 Concat Object Entities to 不能 识别 LINQ | 更新日期: 2023-09-27 18:13:54
当我试图将数字与LINQ中的字符串连接时,我正在获得LINQ to Entities does not recognize the method 'System.String Concat(System.Object)' method, and this method cannot be translated into a store expression.
错误?如何解决这个问题?
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
我认为你可以用+
连接字符串。如果您使用Concat
进行隐式字符串转换,请考虑使用SqlFunction.StringConvert