求助大师asp中修改密码错误,有代码?
<!--#include file=yt_conn.asp--><%
ic=request.form("ic")
psw=request.form("psw")
newpassword=request.form("password")
set rs=server.createobject("adodb.recordset")
rs.open "select * from user where username='"&ic&"' and password='"&psw&"'" ,conn,1,1
if rs.eof or rs.bof then
response.write "<script>alert('密码或用户名错误');window.close();</script>"
else
if not (rs.bof and rs.eof) then
rs.close
set rs=nothing
set rs=server.createobject("adodb.recordset")
rs.open "update user set password='"&newpassword&"' where username='"&ic&"'" ,conn,1,1
rs.close
set rs=nothing
response.write "<script>alert('密码修改成功');window.close();</script>"
end if
end if
%>
您好,这段代码是自己想出来,我学asp时不长,不知道对不对,在运行时密码已经修改了,但是提示http500内部服务器错误,无法显示网页,请您帮忙看一下,谢谢!向前辈们致敬
[[i] 本帖最后由 网者 于 2006-11-6 17:00 编辑 [/i]] 我实在想不明白,这段代码在另一个程序中运行正常,为什么只是换了个地方就不行了,而且查看数据库中密码已经被修改了,所以应该就是
rs.close
set rs=nothing
response.write "<script>alert('密码修改成功');window.close();</script>"
end if
end if
这几行不对,可是没道理啊,敬请大师指教! 是不是这儿的不对 ,conn,1,1
可是………,劳烦那位大师看看,或介绍另一种方法,谢谢 哈哈,问题解决了,是由于,conn,1,1
中有个逗号是中文输入的,粗心害死人呐:L :L :L 你比偶厉害~~~~ 看了半天没看出个头绪!!! if not (rs.bof and rs.eof) then
rs.close
set rs=nothing
set rs=server.createobject("adodb.recordset")
rs.open "update user set password='"&newpassword&"' where username='"&ic&"'" ,conn,1,1
你還沒有更改就先把記錄集關閉了(rs.close),設置為空了,怎麼能改呢?再想想
或者在網上找點現成的程序看一下了 哦,漏看了一行
建議你把if not (rs.bof and rs.eof) then後的三句刪掉,試試看(簡捷) 根本就没有看懂
页:
[1]