Dim starttime, endtime As Date
starttime = DTPicker3.Value
endtime = DTPicker4.Value
1、
select * from GG
where CheckDate between '" & CStr(Format(starttime, "YYYY-MM-DD HH:MM")) & "' and '" & CStr(Format(endtime, "YYYY-MM-DD HH:MM")) & "'
2
select * from GG
where CheckDate between '" & CStr(starttime) & "' and '" & CStr(endtime) & "'
3
select * from GG
where CheckDate between '" & starttime & "' and '" & endtime & "'
starttime = DTPicker3.Value
endtime = DTPicker4.Value
1、
select * from GG
where CheckDate between '" & CStr(Format(starttime, "YYYY-MM-DD HH:MM")) & "' and '" & CStr(Format(endtime, "YYYY-MM-DD HH:MM")) & "'
2
select * from GG
where CheckDate between '" & CStr(starttime) & "' and '" & CStr(endtime) & "'
3
select * from GG
where CheckDate between '" & starttime & "' and '" & endtime & "'
select * from GG where checkdate between '2000-02-04 14:20:00' and '2007-02-04 14:20:00';
而且上面的三条语句调试时变量的值也是正确的。谢谢各位了!甚至调试出的SQL语句就是上面的语句
select * from GG where checkdate between '2000-02-04 14:20:00' and '2007-02-04 14:20:00'
但就是查询不出数据来。