#1 2011-09-20 13:55:37

noobies
Member
Registered: 2011-09-13
Posts: 139

correct like query

i try search record with like

not work

Rec := TSQLDataRec.Create(Database, 'Fam like "%"', [Search.Text]);

work

Rec := TSQLDataRec.Create(Database, 'Fam like "%"', [Search.Text + '%']);
  Rec := TSQLDataRec.Create(Database, 'Fam like "%' + Search.Text + '%"');

Offline

#2 2011-09-20 17:24:23

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,660
Website

Re: correct like query

About LIKE operator in SQLite3:
http://www.sqlite.org/lang_expr.html
This is IMHO the perfectly standard use of LIKE in SQL - see http://sqlzoo.net/howto/source/u.cgi/tip977255

And you should better use a prepared statement and use single quotes, as specified by SQLite3.
Read the mORMot documentation about prepared statements.

Offline

#3 2011-09-21 06:11:10

noobies
Member
Registered: 2011-09-13
Posts: 139

Re: correct like query

thank for reply i found solution:

Rec := TSQLDataRec.Create(Database, 'Fam like "%%%"', [Search.Text]);

its work fine!

Offline

Board footer

Powered by FluxBB