TMyQuery filter on DATE fields

TMyQuery filter on DATE fields

Postby Hans » Mon 24 Oct 2005 21:11

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
Hans
 
Posts: 52
Joined: Wed 24 Aug 2005 20:05

Postby GEswin » Mon 24 Oct 2005 21:16

Try
Code: Select all
'STARTDATE = "2005-01-01"'

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

Regards
GEswin
 
Posts: 186
Joined: Wed 03 Nov 2004 16:57
Location: Spain

Postby Ikar » Tue 25 Oct 2005 09:44

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.
Ikar
 
Posts: 1693
Joined: Thu 28 Oct 2004 13:56


Return to MySQL Data Access Components