Monday, 15 September 2014

c# - Operator '||' cannot be applied to operands of type 'string' and 'bool' -



c# - Operator '||' cannot be applied to operands of type 'string' and 'bool' -

i dont know why meantime compile query in linq follows below

from c in pricelistpolicies_tbls ((c.countrycode ?? "vnall")== "vnall" ? "vn" : c.countrycode || (c.countrycode ?? "thall") == "thall" ? "th" : c.countrycode) select c

gives error

operator '||' cannot applied operands of type 'string' , 'bool'

how can query work?

try this:

from c in pricelistpolicies_tbls ( ((c.countrycode ?? "vnall") == "vnall" ? "vn" : c.countrycode) || ((c.countrycode ?? "thall") == "thall" ? "th" : c.countrycode) ) select c

c# .net linq linq-to-sql

No comments:

Post a Comment