Search code examples
sqloperator-keywordsql-likelinqpad

LinqPad like operator error


I am new to linqpad and C#. I wish to get the list of ids starting with "ic" in odata. I tried SqlMethods.like and got this error. "The name 'SqlMethods' does not exist in the current context"

Below is the query

from id in Products

where SqlMethods.Like(id.ProductId, "IC%")

select id

please help. unable to find solution


Solution

  • OData doesn't support Like operator. So even if you would get the above to compile it still wouldn't work correctly. If you just want to find all products who's id starts with IC you can use the StartsWith method:

    from id in Products
    where id.ProductId.StartsWith("IC")
    select id;