急!!送上30分ASP关于根据日期提取ACCESS字段问题

来源:百度知道 编辑:UC知道 时间:2024/09/21 22:05:58
我写了个投票IP判断,如果IP和日期已存在则不能投票
if tp="tp" then
ip=request.servervariables("http_x_forwarded_for")
if ip="" or ip="unknow" then
ip=request.servervariables("REMOTE_HOST")
date=date()
end if

set rs=server.CreateObject("adodb.recordset")
rs.open "select * from tp_ip where ip=ip and tp_day=#"& date &"# "",connkillsql,1,1

if not(rs.eof and rs.bof) then
Response.write("<script language='javascript'>alert('一个IP一天只能投一票,请明天再投票!');history.back();</script>")
rs.close
set rs=nothing
Response.end()
end if

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tp_day=#"& date &"# " 这句是不是有问题啊,加上日期就怎么判断都是已投过票,是不是格式不对啊?
本机上测试时正常的啊,上传的网上就不行了,怎么投都说已投过

rs.open "select * from tp_ip where ip=ip and tp_day=#"& date &"# "",connkillsql,1,1
这出问题了,IP=IP,前一个是字段,后一个是变量,但是不能这么表示的!
rs.open "select * from tp_ip where ip="& ip &" and tp_day=#"& date &"# "",connkillsql,1,1

ip='"&ip&"' and

可能你当天已经有人投过票了,所以会出错...因为IP的条件语句写错了..