Page 1 of 1

TMyQuery filter on DATE fields

Posted: Mon 24 Oct 2005 21:11
by Hans
Hi,

I am Using Delphi7 + MySQL 5.0 + MyDac 4.x. Now I try to set a filter in the TMyQuery component, but when filtering on a DATE field I get an error. This also goes wrong with TIME fields. I guess I do something wrong and think it has to do with the format. Anyway I tried ddmmyyy etc. but no results.

I set the filter to "START_DATE=1-1-2005" and than I get an exception "illegal filter expression". Can somebody give me a hint how to accomplish a filter on DATE fields?

Thanks in Advance!

best regards,
Hans

Posted: Mon 24 Oct 2005 21:16
by GEswin
Try

Code: Select all

'STARTDATE = "2005-01-01"'

(I use FormatDateTime('yyyy-mm-dd')

Regards

Posted: Tue 25 Oct 2005 09:44
by Ikar
If you use Filter property (not FilterSQL), then filtration executing on client side. You should quote filter value, for example MyQuery4.Filter := 'c_date = "2005-10-21"'. In quotes you should use format, compatible with VarToDateTime function.