麻烦大家帮我调试一下这段代码,本人在线等,答好了,一定给分

dss_526 2006-08-25 10:56:29
set rs=conn.execute("select * from user_reg a,doctor_reg b where a.username='" &username& "' or b.username='" &username& "'")
if trim(request("userpassword"))<>"" then
rs("password")=md5(trim(request("userpassword")))
end if
rs.update
rs.close
set rs=nothing
response.Write "<script language=javascript>alert('密码更改成功!');window.location.href='"&request.servervariables("http_referer")&"';</script>"
response.End
...全文
177 7 打赏 收藏 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
xzr2004 2006-08-25
  • 打赏
  • 举报
回复
注意:password,username可能与数据库中的关键字冲突,以后请不要用
strSQL = "select [password] from user_reg where [username]='"username"'"
rs.open strSQL,conn,1,3
if rs.eof then
rs.close
strSQL = "select [password] from doctor_reg where [username]='"username"'"
rs.open strSQL,conn,1,3
if rs.eof then
Response.Write("没有找到相关信息!")
end if
rs.close
Response.End()
end if
if trim(request("userpassword"))<>"" then
rs("password")=md5(trim(request("userpassword")))
end if
rs.update
rs.close
set rs=nothing
response.Write "<script language=javascript>alert('密码更改成功!');window.location.href='"&request.servervariables("http_referer")&"';</script>"
response.End
dss_526 2006-08-25
  • 打赏
  • 举报
回复
pyj2004() :

那你能把代码写一下吗,如果按照两个表的形式,麻烦你把代码给我写一下吧
taoyi1105 2006-08-25
  • 打赏
  • 举报
回复
同意楼上
pyj2004 2006-08-25
  • 打赏
  • 举报
回复
完全可以写在一个表里的嘛,设置一个用户类型字段就可以了

实在不行的话,就只有写两个sql语句,先在一个表里查询是否存在记录,不存在就执行另一条查询
dss_526 2006-08-25
  • 打赏
  • 举报
回复
我要修改密码,但是有两种用户,普通用户和医生用户,这两个表是分开的,所以我要对两个表进行操作,如果这个用户是医生,就得提取医生表中的信息,然后修改医生表中用户的密码,但是我不知道该怎么写了,请大家帮帮忙吧!!快快快!!
penglewen 2006-08-25
  • 打赏
  • 举报
回复
不过建议你还是用一张表,设定一个字段来标识.............
set rs=conn.execute("select * from user_reg where username='"&username&"'")
if rs.eof and rs.bof then
set rs_doc =conn.execute("select * from doctor_reg where username='"&username&"'")
if rs_doc.eof and rs_doc.bof then
response.write"没有找到用户.":response.end()
else
if trim(request("userpassword"))<>"" then rs_doc("password")=md5(trim(request("userpassword")))
rs_doc.update
rs_doc.close:set rs_doc=nothing
response.Write "<script language=javascript>alert('密码更改成功!');window.location.href='"&request.servervariables("http_referer")&"';</script>"
end if
else
if trim(request("userpassword"))<>"" then rs("password")=md5(trim(request("userpassword")))
rs.update
rs.close:set rs=nothing
response.Write "<script language=javascript>alert('密码更改成功!');window.location.href='"&request.servervariables("http_referer")&"';</script>"
end if
dss_526 2006-08-25
  • 打赏
  • 举报
回复
xzr2004(漫步云端):
我改成这样了,但是当查询第二个表的时候就不好使了,为什么呀??

28,402

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧