[求助]ADODB.Recordset (0x800A0BCD)
错误类型:
ADODB.Recordset (0x800A0BCD)
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。
/check.asp, 第 110 行
可是,那个位置明明有记录的……同样的查询在别的地方就可以查到……
110行: rs("u_password") = pass3
以下为97-119行
Case "ChangePassword"
Call CheckRoot()
pass2=md5_net(replace(trim(request.form("pass2")),"'",""))
pass3=md5_net(replace(trim(request.form("pass3")),"'",""))
If pass2<>pass3 Then
response.write "<script type='text/javascript'>alert('New Password are not the same!');"
response.write "this.location.href='vbscript:history.back()';</script>"
response.End
End If
set rs=server.createobject("adodb.recordset")
sql="select * from admin where u_name='"&username&"'"
rs.open sql,conn,1,3
If rs.bof and rs.eof Then
rs("u_password") = pass3
rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
response.write "<script type='text/javascript'>alert('密码修改成功!');"
response.write "this.location.href='index.asp';</script>"
response.End
End If
Call CheckRoot()
pass2=md5_net(replace(trim(request.form("pass2")),"'",""))
pass3=md5_net(replace(trim(request.form("pass3")),"'",""))
If pass2<>pass3 Then
response.write "<script type='text/javascript'>alert('New Password are not the same!');"
response.write "this.location.href='vbscript:history.back()';</script>"
response.End
End If
set rs=server.createobject("adodb.recordset")
sql="select * from admin where u_name='"&username&"'"
rs.open sql,conn,1,3
If rs.bof and rs.eof Then
rs("u_password") = pass3
rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
response.write "<script type='text/javascript'>alert('密码修改成功!');"
response.write "this.location.href='index.asp';</script>"
response.End
End If
代码中使用了CheckRoot()的模块。以下为CheckRoot()内容:
Function CheckRoot()
username=replace(trim(request.form("username")),"'","")
password=md5_net(replace(trim(request.form("password")),"'",""))
set rs=server.createobject("adodb.recordset")
sql="select * from admin where u_name='"&username&"'"
rs.open sql,conn,1,1
If rs.bof and rs.eof Then
response.write "<script type='text/javascript'>alert('Username or Passward is not valid!');"
response.write "this.location.href='vbscript:history.back()';</script>"
response.End
Else If rs("u_password")<>password Then
response.write "<script type='text/javascript'>alert('Username or Passward is not valid!');"
response.write "this.location.href='vbscript:history.back()';</script>"
response.End
End If
End If
End function
username=replace(trim(request.form("username")),"'","")
password=md5_net(replace(trim(request.form("password")),"'",""))
set rs=server.createobject("adodb.recordset")
sql="select * from admin where u_name='"&username&"'"
rs.open sql,conn,1,1
If rs.bof and rs.eof Then
response.write "<script type='text/javascript'>alert('Username or Passward is not valid!');"
response.write "this.location.href='vbscript:history.back()';</script>"
response.End
Else If rs("u_password")<>password Then
response.write "<script type='text/javascript'>alert('Username or Passward is not valid!');"
response.write "this.location.href='vbscript:history.back()';</script>"
response.End
End If
End If
End function
都是“rs("u_password") ”,在CheckRoot()里面就可以通过……为什么到后面就说记录不存在呢?