0

is there an equivalent from '_' in SQL to Linq.

In SQL it is like a white-space, so it selects everything and ignores this char.

e.g. SELECT * FROM customers WHERE customers.ID LIKE '12431466_1'selects all IDs with 12431266 and at the end 1

1 Answers1

0

The answer depends on your specific needs:

If you're using linq-to-sql and would like it to run the query you posted, you can use the same string with SqlMethods.Like.

If you want to have a solution for linq-to-objects or a custom linq provider, you'll need to either use string methods running inside the C# runtime, like StartsWith and EndsWith or use Regext.IsMatch or something similar.

Muaz Othman
  • 427
  • 4
  • 13