ZTable SQL Query

Forum related to MySQL

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
Chaosowns
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 21.07.2009, 14:52

ZTable SQL Query

Post 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?
seawolf
Zeos Dev Team *
Zeos Dev Team *
Posts: 385
Joined: 04.06.2008, 19:50
Contact:

Post by seawolf »

Have you tried this?

ZTable1.Filter :='`PatientID` like %' + QuotedStr(Edit1.Text)+'%';
Chaosowns
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 21.07.2009, 14:52

Post 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!!
Post Reply