Like

Discussion of open issues, suggestions and bugs regarding EntityDAC
Post Reply
AudioPat
Posts: 10
Joined: Fri 19 Jun 2015 15:47

Like

Post by 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 + '%'

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Like

Post by 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;

Post Reply