帮忙看看这段代码???
我的意思是想当输入的日期 p1 在数据库中不存在的时候就转到 none.htm 页面
我这段代码的想法有个困惑就是我饿数据库中假如有2001.01.01/2001.01.02/2001.01.03三天的数据而我输入的是2001.01.04,我怎么把2001.01.04和2001.01.01/2001.01.02/2001.01.03进行对比?
现在这段代码当你输入数据库中没有的日期时他会转到 none.htm 页面提示无数据,但当我输入数据库中存在的日期的时候,有时候提示 if p1<>rs.fields("nowdate") then 这一行出错,有时候也转到了 none.htm 页面提示无数据,我搞不懂了,麻烦帮帮忙~!
<%
dim connstr
connstr="dsn=smoke;uid=sa;pwd=;"
set conn=server.createobject("adodb.connection")
set rs=server.createobject("adodb.recordset")
y1=request.form("date_year")
m1=request.form("date_month")
d1=request.form("date_date")
p1=""&y1&"."&m1&"."&d1&""
sqlstr="select nowdate from date1"
rs.open sqlstr,connstr
do while not rs.eof
if p1<>rs.fields("nowdate") then
response.redirect "none.htm"
else
-------
end if
loop
rs.close
set conn=nothing
%>