日期:2014-05-17  浏览次数:20709 次

用户名密码验证问题!那位高手帮帮小弟!
我做了个用户登陆页面
程序代码如下:
                  ……
                  dim   mSql,rs,m_Sql
dim   mUserName,mPassword
dim   mIntegral
const   DEF_MasterCookies   =   "www.ly8.net "
           
mUserName   =   checkStr(Trim(Request.Form( "username ")))
mPassword   =   checkStr(Trim(Request.Form( "password ")))
if   mUserName= " "   or   mPassword= " "   then  
      call   Msgbox( "对不起,请输入后提交! ",1)
              Response.end
        end   if
m_Sql   =   "Select   Points   FROM   [LeadBBS_User]   where   UserName= ' "   &   mUserName   &   " ' "
Set   Rs   =   conn.Execute(m_Sql)
mIntegral   =   Rs( "Points ")
'查找用户
mSql   =   "Select   F_ID,F_UserName,F_Password,F_RealName,F_Email,F_Tel,f_grade,F_Mobile,F_WebSite,F_Address   from   T_Member   Where   F_IsCheck=1   and   F_UserName= ' "   &   mUserName   &   " ' "
        Set   rs   =   conn.Execute(mSql)

if   rs.BOF   and   rs.EOF   then
      '无此用户
      call   Msgbox( "对不起,不存在该用户名,或该用户名已被锁定.需管理员审核! ",1)
              Response.end
else
            if   md5(mPassword) <> rs( "F_PassWord ")   then
                    '密码错误
    'rs.Close
           
    Call   Msgbox( "对不起,您的密码不正确!请输入正确的密码! ",1)
 
      else
……

打开页面当我输入错误的用户名和密码提交后出现如下错误提示:

错误类型:
ADODB.Field   (0x800A0BCD)
BOF   或   EOF   中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。
/hello/Club/ChkLogin.asp,   第   18   行

说明:我数据库里的记录都不是空的

------解决方案--------------------
m_Sql = "Select Points FROM [LeadBBS_User] where UserName= ' " & mUserName & " ' "
Set Rs = conn.Execute(m_Sql)
if rs.eof then
response.write "注册的用户名不存在 "
else
mIntegral = Rs( "Points ")
end if