TSQLQuery.filter problem lazarus / 16-Databases ---------------------------------------------------------------------- plavicka · 2013-12-30 16:11 Hi! I have problem with TSQLQuery.Filter function. I need to create a filter to select a date of birthday. My source code looks like this: TSQLQuery.Filter := 'BIRTHDAY="05.06.1960"'; TSQLQuery.Filtered := True; When I run this application, this error message is displayed: Index based on uknown field "=" What is wrong? I also try another date format (1960-06-05, 1960/06/05, 05/06/1960...), but result is the same. I use Firebird 2.5 database and SQLDB components. Thank you for you answer. Pavel ---------------------------------------------------------------------- BigChimp · 2013-12-30 16:15 Welcome to the forum! What is wrong is that you don't use the correct syntax. Unfortunately it is not easy to figure out what syntax should be used... sqldb uses the tdbf filtering code, so please see http://wiki.lazarus.freepascal.org/Lazarus_Tdbf_Tutorial#Expressions http://wiki.lazarus.freepascal.org/Lazarus_Tdbf_Tutorial#Filters If you have any questions, please don't hesitate to post! ---------------------------------------------------------------------- BigChimp · 2013-12-30 16:23 So that would be something like Code: [Select]TSQLQuery.Filter := 'DTOS(BIRTHDAY)="19600605"'; TSQLQuery.Filtered := True; if I'm correct... Edit: now that you brought it up, I think there should be a way to specify a date literal and avoid DTOS. Perhaps there is a way, would have to look in the source code. ---------------------------------------------------------------------- plavicka · 2013-12-30 16:56 Thank you very much, everything now works correctly. Pavel