Like

Like

Postby AudioPat » Fri 19 Jun 2015 15:51

Hi,

We use the EntityDac in our Delphi project, but how to use a like statement for searching records?

SQL Example:
Where IsNull(Column, '') LIKE '%' + :parameter + '%'
AudioPat
 
Posts: 10
Joined: Fri 19 Jun 2015 15:47

Re: Like

Postby AlexP » Tue 23 Jun 2015 07:50

Hello,

An analogue for the LIKE SQL operator is the Contains operator in LINQ :

Code: Select all
var
  E: IEmpExpression;
  Query: ILinqQueryable;
begin
  E := Context.Emp;
  Query := Linq.From(E)
               .Where(E.EName.Contains('%TEST%'))
               .Select([E.EmpNo, E.EName, E.Dept.DName]);
...
end;
AlexP
Devart Team
 
Posts: 5530
Joined: Tue 10 Aug 2010 11:35


Return to EntityDAC