Problem querying date/time fields

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
GEswin
Posts: 186
Joined: Wed 03 Nov 2004 16:57
Location: Spain
Contact:

Problem querying date/time fields

Post by GEswin » Wed 23 Mar 2005 16:52

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.

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Fri 25 Mar 2005 13:50

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.

kenny
Posts: 43
Joined: Mon 15 Nov 2004 08:48
Location: Malaysia
Contact:

Post by kenny » Sat 26 Mar 2005 09:36

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:

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

Post by GEswin » Sat 26 Mar 2005 19:27

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.

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

Post by GEswin » Mon 28 Mar 2005 10:27

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

Post Reply