如果是ACCESS,是这么用:
COleDateTime start(year,month,1,0,0,0);
COleDateTime end(year,month+1,1,0,0,0);
s = start.Format("%Y-%m-%d %H:%M:%S");
e = end.Format("%Y-%m-%d %H:%M:%S");
sql.Format("select * from OutCord where OutTime>=#%s# and OutTime<=#%s#",s,e);
COleDateTime time;
end = time.Format("%Y-%m-%d %H:%M:%S");
COleDateTime time(year,month+1,1,0,0,0);
end = time.Format("%Y-%m-%d %H:%M:%S");
sql.Format("select * from [Transformer] where [DeviceID]='%s' and [CheckTime]>'%s' and [CheckTime]<'%s'",deviceid,start,end);