VBS网页只能登上数据库中第一条记录,怎样改?求!

来源:百度知道 编辑:UC知道 时间:2024/06/30 18:56:11
求求求求求求求求!!!!!!!!!!!!!
<!--#include file="conn.asp"-->
<%
rscount=conn.execute("select count(*) from suser")
yhm=request.Form("szhanghao")
set rs=server.CreateObject("ADODB.RECORDSET")
sql="SELECT xingming FROM suser"
rs.open sql,conn,1,1
if yhm=rs("xingming") then
response.Redirect"index.asp?msg=登录成功!"
else response.Redirect"index.asp?msg=没这个人"
end if
%>

提示,你应该在数据库中查找有没有符合xingming=yhm 的记录。而不是将所有的记录都提取出来再检查。如果有的话说明存在。否则就不存在啊
希望对你有帮助
sql="SELECT xingming FROM suser where xingming='" & yhm & "'"
rs.open sql,conn,1,1
if not rs.bof and rs.eof then
response.Redirect"index.asp?msg=登录成功!"
else
response.Redirect"index.asp?msg=没这个人"
end if