ASP动态网页密码修改功能出现的问题

<!--#includefile="db.inc.asp"--><%setrst=Server.CreateObject("ADODB.Recordset")onerro... <!-- #include file = "db.inc.asp"-->
<%
set rst = Server.CreateObject("ADODB.Recordset")
on error resume next
id = request.QueryString("id")
if request.QueryString("act") = "modify" then
conn.begintrans
rst.open"Select * from member where i_uid = " & id,conn,1,3
if rst("i_code") = request.form("i_code1") then
rst("i_code") = request.form("i_code2")
rst.update
else
err.number=err.number+1
end if
if request.form("i_code2")<>request.form("i_code3") then
err.number=err.number+1
end if
end if
%>

<%
rst.close
id = request.QueryString("id")
rst.open"Select * from member where i_uid = " & id,conn,1,1
%>
尊敬的<%=rst("i_name")%>你好!请你按要求填写以下信息完成密码修改:<br><br>
<form id="form1" name="form1" method="post" action="modify.asp?act=modify&id=<%=request.QueryString("id")%>">
<span class="STYLE7">输入旧密码:</span>  
<input type="password" name ="i_code1" size="30"><br><br>
<span class="STYLE7">输入新密码:</span>  
<input type="password" name ="i_code2" size="30"><br><br>
<span class="STYLE7">确认新密码:</span>   
<input type="password" name ="i_code3" size="30"><br><br><br><br>
           <input type="submit"name="Submit" value="提交"/>      <input type="reset"name="ReSet" value="重置"/>
</form>
<%
if err.number<>0 then
conn.RollbackTrans
response.Write("密码修改失败!")
else
conn.CommitTrans
response.Write("密码修改成功!")
end if
%>
</td>
</tr>
</table>
<%
rst.close
set rst = nothing
conn.close
set conn = nothing
%>
该段代码已经实现了密码的修改,可是网页一打开就直接出现密码修改失败这句结论,但是对密码修改这个功能没有影响,也就是说网页一打开直接执行了else后面的response.write("密码修改失败")这条语句,为什么?
开头的那个include是打开数据库连接,是网页一旦打开就直接执行了if 后面的response.write("密码修改失败")这句话,不是else后面的,刚才写的有点问题
展开
 我来答
ahaoge6901
2009-04-27 · TA获得超过171个赞
知道小有建树答主
回答量:304
采纳率:0%
帮助的人:304万
展开全部
试试看:<!-- #include file = "db.inc.asp"-->
<% sub editpassword()
set rst = Server.CreateObject("ADODB.Recordset")
on error resume next
id = request.QueryString("id")
if request.QueryString("act") = "modify" then
conn.begintrans
rst.open"Select * from member where i_uid = " & id,conn,1,3
if rst("i_code"雀孙) = request.form("i_code1") then
rst("i_code") = request.form("i_code2")
rst.update
else
err.number=err.number+1
end if
if request.form("i_code2")<>request.form("i_code3") then
err.number=err.number+1
end if
end if
if err.number<>0 then
conn.RollbackTrans
response.Write("密码修改失败!")
else
conn.CommitTrans
response.Write("密码修改成功!")
end if
rst.close
set rst = nothing
conn.close
set conn = nothing
end sub
%>

<%
rst.close
id = request.QueryString("id")
rst.open"Select * from member where i_uid = " & id,conn,1,1
%>
尊敬的<%=rst("i_name")%>你好!请你按要求填写以下信息完成密码修改:<br><br>
<form id="form1" name="form1" method="post" action="modify.asp?act=modify&id=<%=request.QueryString("id")%>">
<span class="STYLE7">输入旧密码:</span>
<input type="password" name ="i_code1" size="30"><br><br>
<span class="STYLE7">输入新密码:</span>
<input type="password" name ="i_code2" size="30"><br><br>
<span class="STYLE7">确认新密码:</span>
<input type="password" name ="i_code3" size="30"><br><br><br><br>
<input type="submit"name="Submit" value="提交"/> <input type="reset"name="ReSet" value="重置"/>
</form>
</td>
</tr>
</table>
<顷老链%if request.form("submit")="提交"含渗 then
Call EditPassword()
end if
%>
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
DeadlYBlinder
2009-04-27 · TA获得超过132个赞
知道小有建树答主
回答量:137
采纳率:0%
帮助的人:64.5万
展开全部
直接显示这个是肯定的,因为你的

<%
if err.number<>0 then
conn.RollbackTrans
response.Write("密码祥滚修改失败!")
else
conn.CommitTrans
response.Write("密码修改成功!")
end if
%>

位置错了

修改方法很简单

<!-- #include file = "db.inc.asp"-->
<%

set rst = Server.CreateObject("ADODB.Recordset")
on error resume next
id = request.QueryString("id")
if request.QueryString("act") = "modify" then
conn.begintrans
rst.open"Select * from member where i_uid = " & id,conn,1,3
if rst("i_code") = request.form("i_code1") then
rst("i_code") = request.form("i_code2")
rst.update
else
err.number=err.number+1
end if
if request.form("i_code2")<>request.form("i_code3") then
err.number=err.number+1
end if
if err.number<>0 then
conn.RollbackTrans
response.Write("密码修改失败!")
else
conn.CommitTrans
response.Write("密码修改成功!")
end if
end if

rst.close

id = request.QueryString("id")
rst.open"高宴顷Select * from member where i_uid = " & id,conn,1,1
%>
尊敬的<%=rst("i_name")%>你好!请你按要求填写以下信息完成密码修改:<br><br>
<form id="form1" name="form1" method="post" action="modify.asp?act=modify&id=<%=request.QueryString("id")%>">
<span class="STYLE7">输入旧密码:</span>
<input type="password" name ="i_code1" size="30"><br><br>
<span class="STYLE7">输入新密码:</span>
<input type="password" name ="i_code2" size="30"><br><br>
<span class="STYLE7">确认新密码:</span>
<input type="password" name ="i_code3" size="30"><br><br><br><br>
<input type="submit"name="Submit" value="提交"/> <input type="reset"name="ReSet" value="重置"/>
</form>
<%
%>
<戚陆/td>
</tr>
</table>
<%
rst.close
set rst = nothing
conn.close
set conn = nothing
%>
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式