当前位置:首页 » 多媒体相关

奇怪的问题,关于sql和vb


sql数据库  
  cnemployee,rsemployee设置都没有问题,  
  比如username=123     password=456  
  我输入都没有问题,可是她老是执行msgbox   "无效的密码,请重试!",   ,   "登录"  
  这到底是为什么?怎么回事?都快被她逼疯了,到底是哪里错了  
   
  rsemployee.open   "select   *   from   usermessage   where   username   =   "   &   txtusername.text   &   "",   cnemployee,   adopendynamic,   adlockoptimistic  
          dim   p,   q   as   string  
          p   =   rsemployee.fields("password")  
          q   =   txtpassword.text  
          print   p   &   q                     这里输出的也都是相同456  
          检查正确的密码  
                  if   p   =   q   then  
                  msgbox   "come   in"  
                  me.hide  
          else  
                  msgbox   "无效的密码,请重试!",   ,   "登录"  
                  txtpassword.setfocus  
                 
          end   if

推荐阅读

  • 如何用elsave清除日志 [详细内容]
  • 电信网通左手打右手 IP电话疯抢长话市场 [详细内容]
  • 技术进步打破固话垄断 移动打长话价格战 [详细内容]
  • 用安全模板修改XP系统日志设置 [详细内容]
  • 6230i可用的一些*#命令 [详细内容]
  • 手机莫名被骚扰 “呼死你”系统惹人心烦 [详细内容]
  • 巧妙清除本地和远程日志文件 [详细内容]
  • 网友回答:
    网友:victorycyz

    if   trim(p)   =   trim(q)   then     ‘会不会有空格?

    网友:yunfeng007

    是啊,会不会有空格?

    网友:leftie

    if   rsemployee.state=adstateopen   then   rsemployee.close  
      rsemployee.open   "select   *   from   usermessage   where   username   =   "   &   txtusername.text   &   "",   cnemployee,   adopendynamic,   adlockoptimistic  
      if   rsemployee.recordcount=0   then  
              msgbox   "没有此用户名,请重新输入!",48,"提示"  
              txtusername.setfocus  
              eixt   sub  
      else  
              if   not   (isnull(rs!password)   or   rs!password="")   then         数据库中密码字段不为空  
                      if   rs!password=trim(txtpassword.text)   then  
                              msgbox   "come   in"  
                              me.hide  
                      else  
                              msgbox     "无效的密码,请重试!",   ,   "登录"  
                              txtpassword.setfocus  
                              exit   sub  
                      end   if  
              else           数据库中密码字段为空  
                      if   trim(txtpassword.text)<>""   then  
                              msgbox     "无效的密码,请重试!",   ,   "登录"  
                              txtpassword.setfocus  
                              exit   sub  
                      else  
                              msgbox   "come   in"  
                              me.hide  
                      end   if  
              end   if  
      end   if  
     

    网友:suntt

    楼上的真是严谨

    网友:suron128

    p   =   trim(rsemployee.fields("password"))  
              q   =   trim(txtpassword.text)  
       
     

    网友:alicky

    rsemployee.open   "select   *   from   usermessage   where   username   =   "   &   trim(txtusername.text)   &   "",   cnemployee,   adopendynamic,   adlockoptimistic

    网友:wudid007

    会不会是两变量类型不一样。

    网友:qinyueh

    可能是没有去掉空格的问题

    网友:qingming81

    全部转成数字类型来比较。

    网友:qingming81

    if   clng(p)   =   clng(q)   then  
            --  
      else  
          --  
      end   if

    网友:tyronelg

    是空格,我以前也碰到过

    网友:mark3798

    嗯。楼主试试看

    .

    讨论区

    Login