Parambyname doesn't work.
Hi,
I have a TQuery component in Delphi5 looking at a paradox table. I attempt
to assign values to the query, but for some reason, the query seems to
ignore the values I send to it. Can someone please help.
The SQL in the query is as follows:
SELECT DISTINCT Contpackdet.PRODUCT, Contpackdet.VARIETY, Contpackdet.GRADE,
sum(tickets.nett) as Total
FROM "Tickets.DB" tickets
INNER JOIN "contpack.DB" ContPack
ON (ContPack.CONTRACT = tickets.ContractTo)
INNER JOIN "ticketsera.DB" Ticketsera
ON (Ticketsera.Ticket = tickets.Ticket)
INNER JOIN "contpackdet.DB" Contpackdet
ON (ContPack.CONTRACT = Contpackdet.CONTRACT)
WHERE
(ContPack."Exporters Code" = :ex) AND
(Tickets.DateTime >= :ds) and
(Tickets.DateTime <= :de)
GROUP BY Contpackdet.PRODUCT, Contpackdet.VARIETY, Contpackdet.GRADE
I then run the following script:
Query1.close;
Query1.ParamByName('ds').Value := '07/01/2001 00:00:00'; {Date Start}
Query1.ParamByName('de').Value := '06/30/2001 23:59:59'; {Date End}
Query1.open;
(The Paramaters Datatype is of ftDateTime)
And the query gives me results!!!! Of course, if the date end date is less
than the date start date, you would expect the query to return no results.
If I type in the dates manually into the query - I get no results, but if I
use the codes above, I get results!?!
Can someone please help me - this is happening to most of my queries that I
use Parambyname on DateTime fields in Paradox tables!
Thanks & regards
Adam