Accepted answer

Forgive me, without much knowledge about this LINQ usage my answer might be totally off.

This question seems to be related though and suggests that you parse/convert the (quoted in that case!) value.


You say cookie and cookie2 are strings... what about m_CategoryID?

have you tried

ldsCustomerLinks.Where = ldsCustomerLinks.Where + " && CategoryID == " + m_CategoryID.ToString();

OK - I was suspicious of the lack of quotes for CustomerNumber in the 'Where' string, but not confident enough to post it as a suggestion (having a bad SO day!)

So to answer the second question:

the type mismatch comes within the database, where CustomerNumber (I am inferring) is a string, but you are building a query with a number, like

CustomerID == 312 && CustomerNumber == 45654789 && CategoryID == 3

where you should be saying

CustomerID == 312 && CustomerNumber == "45654789" && CategoryID == 3

and to get the quotes within a string (which is enclosed by quotes) you need to use the """ syntax.

Related Query

More Query from same tag