ASP 更新数据库更新不了 看码

来源:百度知道 编辑:UC知道 时间:2024/05/24 15:20:06
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from User where User_Name='"&User_Name&"'" ,conn,1,1
if not(rs.bof and rs.eof) then
if User_Pass=rs("User_Pass") then
Session("User_Name")=rs("User_Name")
rs.Close
set rs=nothing

set rs=server.CreateObject("adodb.recordset")
sql="select * from [User] where User_Name='"&Session("User_Name")&"'"
rs.open sql,conn,1,3
rs("User_LoginTime")=Now()
rs("User_LoginIp")=Request.ServerVariables("REMOTE_ADDR")
rs.update
rs.close
set rs=nothing
response.redirect "Index.Asp"
else
response.Write "<script LANGUAGE='javascript'>alert('登陆失败!您的密码有误!');history.go(-1);</script>"
response.end
end if
else
response.Write "<script LANGUAGE=&

1、
if not(rs.bof and rs.eof) then
问题出在这里,修改为:
if not rs.eof then
2、
if User_Pass=rs("User_Pass") then中
User_Pass变量是否有值,如果没有或不等于rs("User_Pass"),那么就不能更新
3、
rs.open sql,conn,1,3
修改为:
rs.open sql,conn,3,2
4、
rs("User_LoginIp")=Request.ServerVariables("REMOTE_ADDR")
修改为:
rs("User_LoginIp")=Request("REMOTE_ADDR")