Hi all,
I need to select tuples from my database (MS Access) which are in a specific date range. The date ranges (range1 and range2) are entered by the user via a dialog screen.
I know (from a previous post) that I have to use # before and after the date ranges...
I use this select statement, but I keep getting syntax errors.
java.sql.Date range1, range2;
//range1 and range2 assigned vals by user - e.g., 2003-06-20
//and 2003-07-07
String selectQuery =
"SELECT code, borrower, dateOut " +
"FROM LogTable " +
"WHERE dateOut BETWEEN '#" + range1 + "#' AND '#" + range2 + "#'";
Whereas if I use this statement - it returns the correct tuples
"SELECT code, borrower, dateOut " +
"FROM LogTable " +
"WHERE dateOut BETWEEN #2003-06-20# AND #2003-07-07#";
But ofcourse, I need to be able to insert the date range dynamically...
So what is the correct syntax for that?
Thanks,
Hasman.