Jay*_*Jay 3 .net c# linq linq-to-sql
我不知道为什么同时我在linq中编译我的查询,如下所示
from c in PriceListPolicies_TBLs
where ((c.CountryCode ?? "VNALL")== "VNALL" ? "VN" : c.CountryCode ||
(c.CountryCode ?? "THALL") == "THALL" ? "TH" : c.CountryCode)
select c
Run Code Online (Sandbox Code Playgroud)
给出了这个错误
运营商'||' 不能应用于'string'和'bool'类型的操作数
我怎样才能使这个查询起作用?
试试这个:
from c in PriceListPolicies_TBLs
where
(
((c.CountryCode ?? "VNALL") == "VNALL" ? "VN" : c.CountryCode)
||
((c.CountryCode ?? "THALL") == "THALL" ? "TH" : c.CountryCode)
)
select c
Run Code Online (Sandbox Code Playgroud)