LIKE 'FRED_' in Linq to LLBL?

Posts   
 
    
ianvink
User
Posts: 394
Joined: 15-Dec-2006
# Posted on: 29-Oct-2008 14:22:51   

Is there a way to mimic this SQL in Linq to LLBL?

select * from CUSTOMERS where CUSTOMERNAME like 'FRED_'

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 29-Oct-2008 14:28:54   
var q = from c in metaData.Customer
where c.CustomerName.Contains("FRED_")
select c;
ianvink
User
Posts: 394
Joined: 15-Dec-2006
# Posted on: 29-Oct-2008 15:16:27   

But this returns "xxxFREDa" in the list as well. I need to get only FREDa, FREDb, FREDc. One character on the end basically and starts with "FRED".

In Linq to SQL I'd use the SqlMethods.Like() helper function.

Is there something like that in Linq to LLBL?

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 29-Oct-2008 16:13:24   

String: Contains, String.StartsWith and String.EndsWith

var q = from c in metaData.Customer
where c.CustomerName.StartsWith("FRED")
select c;