I'm trying to do something that should be trivial. I'm a teacher at an elementary school, and I'm setting up an ASP form page for teachers to vote each afternoon on which dismissal line behaved best.
I've done this sort of thing before. For example, I've set up a form page teachers use each day to record lunch counts. The results are saved to a database on the website, and a second ASP page displays the result using this "custom query":
SELECT *
FROM Results
WHERE DatePart('y',Results.Timestamp)=DatePart('y',Now() )
ORDER BY teacherName ASC,Timestamp ASC;
That works fine and returns only records made today. For this new form, however, I need records returned within the last 16 hours or so. For this I've tried to use the datediff function, but I can't get it to work. I've tried:
SELECT *
FROM Results
WHERE DATEDIFF('Hour',Results.Timestamp,Now())<=16
ORDER BY line ASC,Timestamp ASC;
Instead of 'Hour' I've tried "Hour", Hour, 'hh', 'hh", and hh. I've tried getdate() instead of Now().
I know the results page is properly connected with the database because I get results if I don't try using a "custom query". I'm using FrontPage 2003. Thanks in advance.