32届香港金像颁奖典礼:ASP语句询问

来源:百度文库 编辑:高考问答 时间:2024/04/29 16:48:05
哪位朋友帮我写一段帐号是否存在于数据库的代码
要不帮我仔细解释一下下面这段代码也行
strsql="select * from user where username='" & strname & "'"
strdsn="dsn=bbs;uid=feng;pwd=feng"
set rs=server.createobject("adodb.recordset")
rs.open strsql,strdsn,1,3
if not (rs.eof and rs.eof) then
response.write "你所用的帐号已经存在,请发变帐号<br><br>"
%>
<a href=javascript:history.back()>上一页</a>
<%
response.end
end if

strsql="select * from user where username='" & strname & "'"
查询表 user username 和 strname 一样的值 赋给变量 strsql
strdsn="dsn=bbs;uid=feng;pwd=feng"
连接数据库
set rs=server.createobject("adodb.recordset")
记录集对象赋给 rs
rs.open strsql,strdsn,1,3
执行上面语句以键盘指针且修改打开数据库
if not (rs.eof and rs.eof) then
如果记录中找不到数据
response.write "你所用的帐号已经存在,请发变帐号<br><br>"
输出.....且换行 下面就不用解释了吧
%>
<a href=javascript:history.back()>上一页</a>
<%
response.end
end if

strsql="select * from user where username='" & strname & "'"
strdsn="dsn=bbs;uid=feng;pwd=feng"
set rs=server.createobject("adodb.recordset")
rs.open strsql,strdsn,1,3
if not (rs.eof and rs.eof) then
response.write "你所用的帐号已经存在,请发变帐号<br><br>"
%>
<a href=javascript:history.back()>上一页</a>
<%
response.end
end if