Page 1 of 1

Date parameters in query don't work with 3.80.0.36

Posted: Wed 04 Apr 2007 12:46
by peetjet
In a delphi program I use date parameters in a query.

Like this:
mq.SQL.Text := 'SELECT * FROM TABLE WHERE A_DATE >= :P_DATE';
mq.Prepare;
mq.ParamByName('P_DATE').Value := DateOf(Some_Date);
mq.Open;

This used to work fine, but after upgrading to SDAC 3.80 this doesn't work
anymore.

I already worked around it by using literal date values, but I still would like a comment on this, because I have more projects that will certainly be affected by this problem.

Peet Terluin

Posted: Wed 04 Apr 2007 14:38
by Jackson
You should specify parameters data type before calling the Prepare method.
For example:

Code: Select all

  mq.SQL.Text := 'SELECT * FROM TABLE WHERE A_DATE >= :P_DATE';
  mq.ParamByName('P_DATE').DataType := ftDateTime;
  mq.Prepare;

Posted: Wed 04 Apr 2007 18:33
by peetjet
Thanks.