时间语法错误,请高手指点。
本机测试结果如下错误类型:
Microsoft JET Database Engine (0x80040E07)
日期的语法错误 在查询表达式 'DateTime < #2009-8-12 上午 07:35:12#' 中。
/inc/Sata.asp, 第 3 行
源代码
<%
Sata = 0
Conn.Execute("Delete From Sata Where DateTime < #"& DateAdd("h",-6,Now()) &"#")
Set Rs = Conn.Execute("Select ID From Sata where IP='"& Request.ServerVariables("Remote_Addr") &"' and DateTime > #"& DateAdd("h",-6,Now()) &"#")
IF Rs.eof Then
sql = "select * from Sata"
Set rs1 = Server.CreateObject("adodb.recordset")
rs1.open sql,conn,1,3
rs1.addnew
Rs1("IP") = Request.ServerVariables("Remote_Addr")
Rs1("DateTime") = Now()
Rs1("Sata") = 0
rs1.update
Rs1.Close
Set Rs1 = Nothing
End IF
Rs.Close
Set Rs = Nothing
Set Rs = Conn.Execute("Select ID From Sata where Sata=0 AND IP='"& Request.ServerVariables("Remote_Addr") &"' and DateTime < #"& DateAdd("s",-300,Now()) &"#")
IF Not Rs.eof Then
Sata = 1
Conn.Execute("Update Sata Set Sata=1 Where ID = "& Rs("ID") &"")
End IF
Rs.Close
Set Rs = Nothing
%>
<script>
var w = 'http://www.';
var Sata = <%=Sata%>;
//
if (Sata == 1){
document.write("<script src="+w+"/Stat/Stat.js>\<\/script\>");
}
//
</script>