Page 1 of 1

ZTable SQL Query

Posted: 21.07.2009, 15:05
by Chaosowns
Hello everyone,

I'm currently making an application with Delphi 7 and i used ZeosLib (6.6.5-Stable) to connect to a MySQL 5 server. It works very great except for the filter. I've read the documentation and seen examples but somehow mine isn't working.

I use a TZConnection componet to connect to the MySQL 5 database server, A TZTable component for every table (there are 7 tables) and 7 TDataSource for every TZTable. Then there's a TDBGrid wich shows all the data of a certain TDataSource.
Basicly it's like this:
TZConnection --> TZTable --> TDataSource --> TDBGrid

Whenever i try to apply filter on the TZTable component e.g.:

ZTable1.Filter :='`PatientID` like ' + QuotedStr(Edit1.Text + '*');
ZTable1.Filtered := True;

The TDBGrid always becomes empty. Even when i try to apply a filter like '`PatientID` > 1'; It just doesnt show anything.

Does anyone have a clue what im doing wrong with the filter?


If the filter isn't suited for what i want is it possible to execute a SQL Query from the TZTable component so the TDBGrid will update to it?

Posted: 22.07.2009, 22:22
by seawolf
Have you tried this?

ZTable1.Filter :='`PatientID` like %' + QuotedStr(Edit1.Text)+'%';

Posted: 27.07.2009, 14:38
by Chaosowns
I GOT IT!

Apperently it doesnt work for me when a column is declared with a space in it. For example when i try the filter on the column `Patient Description` it doesnt work, but when i change the column name to `Patient_Description` it works :).

Thx for all the help, GO ZEOSLIB!!