主题:asp中查询结果如何赋值给一个变量 30
405614518
[专家分:0] 发布于 2007-04-17 22:53:00
asp中查询结果如何赋值给一个变量
select @answerftable from account where zhanghao='" & account & "' ",conn,1,1
为什么answerftable的值为空???????????
我想吧查询的结果和另一个变量进行比较?怎么办
最后更新于:2007-04-17 22:55:00
回复列表 (共1个回复)
沙发
405614518 [专家分:0] 发布于 2007-04-17 22:57:00
<!--#include file="conn.asp"-->
<!--#include file="md5.asp"-->
<%
'从reg.asp页面获取穿过来得变量
account=trim(request.form("account")) '请求表单的变量,定义变量为zhanghao,这里request.form是请求表单的意思
answer=trim(request.form("answer"))
'要求输入完整信息
if account="" or answer="" then
Response.Write "<html><body><center><font size=5>信息不完整!<p>"
Response.Write "<a href='findpassword.asp'>返回重填</a>"
response.end 'response.end 有效地中止代码
end if
'从数据库读出用户注册信息以便于判断是否真的忘记了密码
'先检查帐号是否存在
set rs=server.createobject("adodb.recordset") '利用Server内置对象创建一个记录集
sql="select * from account where zhanghao='"&account&"'" 'SQL语句,上节有详解
rs.open sql,conn,1,1 '用刚才创建的名为rs的记录集打开数据库,设置属性为插入数据
if rs.eof and rs.bof then
response.Write("<script language=javascript> alert('用户不存在!');history.go(-1)</script>") '用javascript脚本提示用户
response.end
rs.close
else '用户存在! 其次读出密码问题写到密码提问处,并读出密码问题和用户输入的进行比较以便判断是否正确,还要读出其email帐号以便发信
rs.open "select @answerftable from account where zhanghao='" & account & "' ",conn,1,1
rs.close
if answer<>answerftable then '有0条记录满足条件
Response.Write "<html><body><center><font size=5>密码答案错误!<p>"
Response.Write "<a href='findpassword.asp'>返回</a>"
Response.Write "</font></center></body></html>"
else '有符合条件的记录
Response.Write "<html><body><center><font size=5>您的密码已经发至你的安全邮箱请注意查收,建议及时修复密码!<p>"
Response.Write "<a href='index.asp'>返回</a>"
Response.Write "</font></center></body></html>"
end if
end if
rs.close '关闭记录集
set rs=nothing '销毁记录集
conn.close '关闭数据库连接
set rs=nothing '销毁数据库连接
%>
这是源代码不知道错在那??????
我来回复