gpt4 book ai didi

c# - LINQ to Entities 无法识别 Replace 方法?

转载 作者:太空狗 更新时间:2023-10-29 19:52:59 26 4
gpt4 key购买 nike

<分区>

如何在 Entity Framework 中使用替换方法。我使用以下代码但遇到错误。

using (SepasProjectEntities sp=new SepasProjectEntities())
{
var query = (from p in sp.HISAccidentLocationMappings
where p.Name.Replace('y','x').Contains(txt1.Text)
select p
).ToList();
}

An exception of type 'System.NotSupportedException' occurred in System.Data.Entity.dll but was not handled in user code

Additional information: LINQ to Entities does not recognize the method 'System.String Replace(Char, Char)' method, and this method cannot be translated into a store expression.

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com