"select * from table_name where 时间>=" & text1.text & " and 时间<=" & text2.text

解决方案 »

  1.   

    Access是
    select * from table_name where 时间>=#" & text1.text & "# and 时间<=#" & text2.text & "#" 
    SQL Server是
    select * from table_name where 时间>='" & text1.text & "' and 时间<='" & text2.text & "'" 
      

  2.   

    select * from table_name where 时间 between '" & text1.text & "' and '" & text2.text & "'" 
      

  3.   

    我的两个控件是DTPicker,是不是把'" & text1.text & "' 换成'" & DTPicker.value & "'就可以了?还是要做一些改动? 
      

  4.   

    where 时间 Between To_Date('" & format(dtpbegin.value,"yyyy-MM-dd hh:mm:ss") & "','YYYY-MM-DD HH24:MI:SS') and To_Date('" & format(dtpEnd.value,"yyyy-MM-dd hh:mm:ss") & "','YYYY-MM-DD HH24:MI:SS')