I'm using LINQ to query my database and my records have a status (Active, Inactive, Hold, Pending, etc...). When I do a contains with the inactive status it also returns active since it does contain that value.
My UI allows the user to check off which statuses they want to return which I pass to my back-end as an array. I know that doing an IN clause in LINQ goes like this "where statuses.contains(t.Status)". My problem is that if I pass in Inactive it will match active because it does contain the word. In T-SQL if I had WHERE status IN ('Inactive') it would only return records that are inactive. Has anyone one done something that behaves like a T-SQL IN clause?
Ok, so I'm embarrassed to say my problem was because it was using a string with comma separated values rather than a string array. As soon as I switch to a string array my query used an IN clause rather than CHARINDEX.
My apologies for not being more specific in my question. @mjwills I noticed you had the answer after I refreshed.