Oracle/linq like command

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
Trixz
Posts: 31
Joined: Thu 30 Apr 2009 07:59

Oracle/linq like command

Post by Trixz » Fri 02 Oct 2009 11:37

Ok, when i run a linq query i can get a like with this syntax

Code: Select all

var x = (from t in context.table
where t.column.startsWith("MyString")
select t);

sql
select t.* from table t where t.column like 'MyString%'

I can also use endWith or contains.
But what if I want to have a sql command that results in

Code: Select all

select t.* from table t where t.column like 'My%String'
is it possible?

Trixz
Posts: 31
Joined: Thu 30 Apr 2009 07:59

Post by Trixz » Fri 02 Oct 2009 11:46

Found it ... did not search ok

Answer: use SqlMethods.Like

Code: Select all

from t in context table
where SqlMethods.Like(t.column, 'My%str_ng'

Post Reply