Page 1 of 1

Like

Posted: Fri 19 Jun 2015 15:51
by AudioPat
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 + '%'

Re: Like

Posted: Tue 23 Jun 2015 07:50
by AlexP
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;