comparing a datetime in WHERE clause inMFC CRecordset
Posted on 2000-03-30
I'm using MFC CRecordset class to select records from an ODBC Data Source (Access). I'm trying to set a filter for a datetime column (named "Date") compared to a value I'm building from data in my program.
for values of m_strFilter, I've tried tried:
"Date > '03/30/00 10:00:00'"
"Date > '10:00:00 03/30/00'"
... and just about every variation on the date format. No records are selected (triple checked that they should have been). I also tried leaving out the time, and comparing against the date only.
I saw some articles referencing the CONVERT function, so I tried that ("Date > CONVERT(datetime,'03/30/00')") However, that gives a CDatabaseException with reason: "CONVERT is an unknown function"