where date between 帮我看看那里不对. ( 积分: 50 )

  • 主题发起人 主题发起人 why_119
  • 开始时间 开始时间
W

why_119

Unregistered / Unconfirmed
GUEST, unregistred user!
t1="#"&FormatDateTime(Now(),2) & " 13:30:10#"
t2="#"&FormatDateTime(Now()-1,2) & " 15:30:10#"
Set rs=Server.CreateObject("Adodb.RecordSet")
sql="select * from dj where datem between '"&t2&"' and '"&t1&"'"用变量就不行.
'sql="select * from dj where datem between #2007-11-20 15:30:10# and #2007-11-21 13:30:10#"这样写就可以
rs.Open sql,conn,1,1

asp的assecc
不知应该如何写呢
 
各位老大 帮帮忙呀...
 
sql="select * from dj where datem between ' +''''+ &t2& +'"' and '" + &t1& + "'"用变量就不行.
你自己注意引号
 
对此 你可以先定义一个字符串 比如 s='''' 然后剩下的就好做了,
sql='select * from dj where datem between ' +s+ &t2& +s+' and '+s+&t1&+s
 
sql=format("select * from dj where datem between #%s 13:30:10# and #%s 15:30:10#",[datetostr(now),datetostr(now)]);
用这个!
 
后退
顶部