In access i used this and its works fine:
(tblReservations_Dates.Date) Between #" & dteBegDate & "# And #" & dteEndDate & "#
Using MySQL I used this:
(tblReservations_Dates.Date) Between '" & dteBegDate & "' And '" & dteEndDate & "'
However the data is not displayed I was just wonderi开发者_运维问答ng if this is the correct syntax for SQL Statement for comparing dates?
- You don't need the brackets around the table.column reference
- You need to make sure the query is submitting the start & end values in the proper datattype - date in this case.
Use STR_TO_DATE to safely convert whatever you're providing into a date datatype for MySQL. If you provide the date format, I'd be happy to update my answer with an example.
You need to make certain that the date strings (dteBegDate and dteEndDate) are in the format expected by MySQL, which would be YYYY-MM-DD HH:MM:SS. So, right now would be
2009-11-25 21:45:52
(in Pacific time). Other than that, it should work fine.
精彩评论