sql - Get current week from Access Date/Time Field in QT? -
i need access database items dates during current week. first day of week monday. can't write datepart query. last attempt was:
qmodel->setquery("select * timetable (datepart(\"ww\",[playdate])=datepart(\"ww\",date()));");
qt returns -3010 mistake:"[microsoft][driver odbc microsoft access] few parameters. expected 1." know other similar queries year() or #somedate# working.
so how can current week items?
use single quotes instead of double quotes in sql statement.
qmodel->setquery("select * timetable datepart('ww',[playdate])=datepart('ww',date());");
assuming change eliminated error, next add option indicate first day of weeks.
qmodel->setquery("select * timetable datepart('ww',[playdate],2)=datepart('ww',date(),2);");
Comments
Post a Comment