I'm new at LINQ, searching the net for LINQ samples that mimic SQL's LIKE statement doesn't satisfy myself.
What I want is producing the same query result as this SQL
SELECT * FROM table_1 WHERE column_1 LIKE '__0%'
I want to query from table_1 where column_1's third character is '0'
Is there equivalent statement in LINQ
:D thank you
You can use the SqlMethods class. It's part of System.Data.Linq (a.k.a. LINQ to SQL).
from item in db.Table1
where SqlMethods.Like(item.Column1, "__0%")
select item;
Likes are produced by following methods: StartsWith
, EndsWith
and Contains
. Try to play with them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With