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

kknaguib

I'm trying to execute this query but for some reason it doesn't like the fact that 2 strings are sitting beside each other, here's 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
                             };

The error is : Operator '&&' cannot be applied to operands of type 'string' and 'string'

Why is it giving me this error? Both ClientName and CurrencyPair are of type string in the database. The error occurs where the asterisks are

Habib

You need double ==, not single = so your where clause should be:

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

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

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

From Dev

LINQ Operator '==' cannot be applied to operands of type 'char' and 'string'

From Dev

operator <= cannot be applied to operands of type string and string

From Dev

C# ERROR Operator * cannot be applied to operands of type 'string' and 'string'

From Dev

Operator '>' and '<' cannot be applied to operands of type 'string' and 'string' C#

From Dev

"Operator '==' cannot be applied to operands of type 'char' and 'string'"

From Dev

Operator >= cannot be applied to operands of type string and datetime

From Dev

Operator '==' cannot be applied to operands of type 'char' and 'string'

From Dev

Operator ‘==’ cannot be applied to operands of type ‘char’ and ‘string’

From Dev

Operator '==' cannot be applied to operands of type string and Enum

From Dev

Operator '-' cannot be applied to operands of type 'float' and 'string'

From Dev

operator '||' cannot be applied to operands of type string and bool

From Dev

Operator '==' cannot be applied to operands of type string and char

From Dev

Operator '>' cannot be applied to operands of type 'object' and 'string'

From Dev

C#: operator '-' cannot be applied to operands of type 'string' and 'int' error

From Dev

Binary operator '~=' cannot be applied to operands of type 'String' and 'String?'

From Dev

Binary operator '>' cannot be applied to operands of type '(String?)' and 'String?'

From Dev

Binary operator '>' cannot be applied to operands of type '(String?)' and 'String?'

From Dev

Binary operator '+' cannot be applied to operands of type 'String' and '() -> String'

From Dev

Operator '+' cannot be applied to operands of type "string" and "method group"

From Dev

concatenate in swift: Binary operator '+' cannot be applied to operands of type 'String' and 'AnyObject'

From Dev

Operator '==' cannot be applied to operands of type 'int' and 'string' error

From Dev

Operator '+' cannot be applied to operands of type "string" and "method group"

From Dev

Error Message: Operator '+' cannot be applied to operands of type 'string' and 'method group'

From Dev

binary operator '==' cannot be applied to operands of type NSDictionary and String in swift 3

From Dev

Operator "-" cannot be applied to operands "string" and "double" C#

From Dev

ASP.NET C# error: Operator * cannot be applied to operands of type 'int' and 'string'

From Dev

Binary operator '+' cannot be applied to two String operands

From Dev

Binary operator "&&" cannot be applied to two String operands

Related Related

  1. 1

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

  2. 2

    LINQ Operator '==' cannot be applied to operands of type 'char' and 'string'

  3. 3

    operator <= cannot be applied to operands of type string and string

  4. 4

    C# ERROR Operator * cannot be applied to operands of type 'string' and 'string'

  5. 5

    Operator '>' and '<' cannot be applied to operands of type 'string' and 'string' C#

  6. 6

    "Operator '==' cannot be applied to operands of type 'char' and 'string'"

  7. 7

    Operator >= cannot be applied to operands of type string and datetime

  8. 8

    Operator '==' cannot be applied to operands of type 'char' and 'string'

  9. 9

    Operator ‘==’ cannot be applied to operands of type ‘char’ and ‘string’

  10. 10

    Operator '==' cannot be applied to operands of type string and Enum

  11. 11

    Operator '-' cannot be applied to operands of type 'float' and 'string'

  12. 12

    operator '||' cannot be applied to operands of type string and bool

  13. 13

    Operator '==' cannot be applied to operands of type string and char

  14. 14

    Operator '>' cannot be applied to operands of type 'object' and 'string'

  15. 15

    C#: operator '-' cannot be applied to operands of type 'string' and 'int' error

  16. 16

    Binary operator '~=' cannot be applied to operands of type 'String' and 'String?'

  17. 17

    Binary operator '>' cannot be applied to operands of type '(String?)' and 'String?'

  18. 18

    Binary operator '>' cannot be applied to operands of type '(String?)' and 'String?'

  19. 19

    Binary operator '+' cannot be applied to operands of type 'String' and '() -> String'

  20. 20

    Operator '+' cannot be applied to operands of type "string" and "method group"

  21. 21

    concatenate in swift: Binary operator '+' cannot be applied to operands of type 'String' and 'AnyObject'

  22. 22

    Operator '==' cannot be applied to operands of type 'int' and 'string' error

  23. 23

    Operator '+' cannot be applied to operands of type "string" and "method group"

  24. 24

    Error Message: Operator '+' cannot be applied to operands of type 'string' and 'method group'

  25. 25

    binary operator '==' cannot be applied to operands of type NSDictionary and String in swift 3

  26. 26

    Operator "-" cannot be applied to operands "string" and "double" C#

  27. 27

    ASP.NET C# error: Operator * cannot be applied to operands of type 'int' and 'string'

  28. 28

    Binary operator '+' cannot be applied to two String operands

  29. 29

    Binary operator "&&" cannot be applied to two String operands

HotTag

Archive