sql = " select * from test where ([name] like '%" & ms & "%') " & _
      " and datediff(day,dateandtime, '" & date() & "')=0"

解决方案 »

  1.   

    sql="select * from test where (name like '%"& ms &"%') and convert(varchar(10),dateandtime ,120)=convert(varchar(10),getdate(),120)
      

  2.   

    取當前時間應當取sql server里的時間getdate()
      

  3.   

    谢谢,不过我不是很懂,麻烦解释一下语句好吗?convert(varchar(10),dateandtime ,120)是什么意思?
      

  4.   

    sql="select * from test where (name like '%"& ms &"%') and (rq like '%"& SUBSTRING(CONVERT(char(4), dateandtime, 21), 0, 11) &"%')"