WPF C # LINQ: Operator '&&' cannot be applied to operands of type 'string' and 'string' query

I am trying to execute this query, but for some reason he doesn’t like the fact that the two lines are sitting next to each other, here is the query:

var FiveSecStatsQuery = from qai in connection.QuickAnalyzerInputs
                             join calP in connection.CalculatedPrices on qai.InputID equals calP.TradeID
                             where ***(qai.ClientName = clientName) && (qai.CurrencyPair = cur_pair)*** 
                             && (calP.Description = PriceDescriptions.FiveSeconds) && (calP.Outcome != null)
                             select new
                             {
                                 calP.Outcome
                             };

Error: Operator '& &' cannot be applied to operands of type 'string' and 'string'

Why does this give me this error? Both ClientName and CurrencyPair have a type string in the database. An error occurs when asterisks

+3
source share
2 answers

You need a double ==, not a single =, so your suggestion whereshould be:

where (qai.ClientName == clientName) && (qai.CurrencyPair == cur_pair)
&& (calP.Description == PriceDescriptions.FiveSeconds) && (calP.Outcome != null)
+13
source

(qai.ClientName = clientName) && (qai.CurrencyPair = cur_pair) (qai.ClientName == clientName) && (qai.CurrencyPair == cur_pair)

+4

All Articles