Hi All,
I'm trying to use a Tquery and SQl for the first time and have read through
the help files but I'm still stuck.
It doesn't seem to give much help on using Dates in a database.
The database I'm using is the Paradox one it comes with. (Sorry Delphi 1 at
the moment)
I can't seem to get it to return records BETWEEN two dates.
This is what I tried:
horseq.sql.clear;
s:='SELECT * from "Events.db" where (Events.Horse="'+namecmb.text+'")
AND(Events."Date" BETWEEN ';
s:=s+'"'+fdate.text+'" and "'+tdate.text+'") order by events."date"';
horseq.sql.add(s);
horseq.open;
current:=horseq.fieldbyname('Date').AsDateTime;
It appeared to work, until I added more records and I've now realised that it
is comparing strings rather than dates.
i.e. "30/4/97" is between "1/4/97" and "3/4/97"
This isn't exactly what I wanted ;)
and I wondered if someone else had any good solutions to this problem.
Is there an SQL echo?
bfn,
si.
Fido: 2:440/7.15 *** SEE IT. LIVE IT. BE IT. TREK_RANKS_UK ***
Internet: huggie@dial.pipex.com
Web: http://ds.dial.pipex.com/huggie
.!. The trick in overcoming temptation, is to play dead.
--- Terminate 4.00/Pro
---------------
* Origin: Fou, con et anglais! (2:440/7.15)
|