real time filtering

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
ben
Posts: 119
Joined: Wed 17 Nov 2004 19:48

real time filtering

Post by ben » Tue 23 Aug 2005 09:05

Hello,

my interface has the following options

[ All Records ]
[ Records A ]
[ Records B ]
[ Records C ]
[ Records D ]
...

and a search box:

Search: [__________________]

that filters records inside the selected area. Example:

SELECT * FROM records
WHERE name LIKE 'A%'
ORDER BY name

when user types on the search box "George"

the query will be:

SELECT * FROM records
WHERE name LIKE 'A%' and name like '%George%'
ORDER BY name

---

In my code:

MyQuery1.SQL.Strings[1] := 'WHERE...";
MyQuery1.Open;

---

is this the right way to do it or is there another better trick?

Thanks

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Tue 23 Aug 2005 09:54

Try to use MyQuery1.Filter and MyQuery1.Filtered properties

Post Reply