Hoorayo
Hoorayo

Reputation: 615

Operator '==' incompatible with operand types 'Boolean?' and 'String'

I was able to use where clause like the first one. But I get an error message when I tried to add "IS_SUBMITTED == FALSE". What do I do? IS_SUBMITTED is boolean type.

(Working)

    dsRequestList.Where = @"REQUEST_DETAIL_TYPE_ID.Contains(""" + RequestID + @""") AND  
APPROVAL_GROUP_ID.Contains(""" + ApprovalID + @""")  AND CREATE_DT >= DateTime.Parse(""" + 
FromDate + @""") AND CREATE_DT <= DateTime.Parse(""" + ToDate + @""")";

(Error) dsRequestList.Where = @"IS_SUBMITTED == """ + "False" + @""" AND REQUEST_DETAIL_TYPE_ID.Contains(""" + RequestID + @""") AND APPROVAL_GROUP_ID.Contains(""" + ApprovalID + @""") AND CREATE_DT >= DateTime.Parse(""" + FromDate + @""") AND CREATE_DT <= DateTime.Parse(""" + ToDate + @""")";

Upvotes: 0

Views: 6180

Answers (1)

MRAB
MRAB

Reputation: 20644

Are you using "=" or "=="?

Also, doesn't this:

@"IS_SUBMITTED == """ + "False" + @""" ...

evaluate to this:

@"IS_SUBMITTED == ""False"" ...

i.e. you're actually comparing IS_SUBMITTED to the string "False" instead of False.

Upvotes: 1

Related Questions