Forums
This topic is locked
comparing date
16 Aug 2001 15:02:42 Phuc Ngo posted:
hello all,Could some one help me with this...
I have a DB with the field called "currentdate" it diaplayed as 3/27/2001 and a "contents" field which holds text.
What I wanted to do here is that a user can enter in a date in the format above and it will display that article for them.
I have written my recordset like this but it not working correctly, it keeps displaying the first record in the DB and not the record that the user wanted. Can someone help please.
SQL:
SELECT currentdate, contents
FROM news
WHERE currentdate LIKE'%varDate%'
Variables:
varDate % Request("currentdate"
Replies
Replied 17 Aug 2001 03:22:10
17 Aug 2001 03:22:10 Owen Eastwick replied:
You're mixing your datatypes.
<b>LIKE</b> is for text data, use <b>=</b> for numeric data types, including dates and currency.
Try this:
SELECT currentdate, contents
FROM news
WHERE currentdate = varDate
Regards
Owen
<b>LIKE</b> is for text data, use <b>=</b> for numeric data types, including dates and currency.
Try this:
SELECT currentdate, contents
FROM news
WHERE currentdate = varDate
Regards
Owen