Page 1 of 1

Problem querying date/time fields

Posted: Wed 23 Mar 2005 16:52
by GEswin

Code: Select all

 DBQbsclliure.SQL.Clear;
 DBQbsclliure.SQL.Add('select distinct(fecha) from doctores_agenda');
 DBQbsclliure.SQL.Add('where codigo_doctor = :coddoc and fecha >= :fecha');
 DBQbsclliure.SQL.Add('and hora > :hora1 and hora = "2005-03-23"
and hora > "00:01:00" and hora < "23:59:00" and nombre is null
order by fecha
With this code I get no results from the query, but if I run this query from mysql, or hardcode date/time into query (2 code part) it works. Looks like the parameters are wrong converted or similar.

hora is a time field, fecha is a date field.

Posted: Fri 25 Mar 2005 13:50
by Ikar
We couldn't reproduce the problem.
Please send us (mydac*crlab*com) complete small sample to demonstrate it and include script to create and fill doctores_agenda.

Posted: Sat 26 Mar 2005 09:36
by kenny
Hi,
Is this possible of the line
DBQbsclliure.ParamByName('fecha').AsDate := cxDateNavigator1.Date
Where the dateformat of cxDateNavigator is not yyyy-mm-dd? Please format it as "yyyy-mm-dd" :wink:

Posted: Sat 26 Mar 2005 19:27
by GEswin
Where the dateformat of cxDateNavigator is not yyyy-mm-dd? Please format it as "yyyy-mm-dd"
Kenny, as I'm passing it as a date, the components set the proper format.
We couldn't reproduce the problem.
Please send us (mydac*crlab*com) complete small sample to demonstrate it and include script to create and fill doctores_agenda.
Ikar, I will prepare a demo tomorrow and send it to support.

Posted: Mon 28 Mar 2005 10:27
by GEswin
Sorry Ikar, my fault.. I was just completing email with database dump etc and then I discovered that I didn't fill the parameter :coddoc , so with reason there was never a result.

regards