if not ADOQuery1.Recordset.EOF and not ADOQuery1.Recordset.bOF then
                Application.MessageBox('登陆成功!','提示信息',mb_ok)
        else
                Application.MessageBox('您输入的用户名或密码错误,请检查!','提示信息',mb_ok);
        
部分源码如上,为什么执行完else以后的语句,又会提示,“当前记录已经删除...”等等。我的本意是找不到记录的话就提示一下。本人初学,谢谢!!!

解决方案 »

  1.   

    else
    begin
      Application.MessageBox('您输入的用户名或密码错误,请检查!','提示信息',mb_ok);
      exit;
    end;
      

  2.   

    ADOQuery1.Eof and ADOQuery1.Bof
      

  3.   

    楼主:
      if not adoquery1.isempty then 
    就行了。楼主的错的原因是。and 两边要用 () and ()
    if not ( ADOQuery1.Eof ) and (ADOQuery1.Bof)  then 
      

  4.   

    赞成Open2ye的上半边,不赞成下半边,因为and的优先级低于not,
    not a and not b等价于
    (not a)and (not b)
    不知道我是不是误解了Open2ye大侠的意思,呵呵
      

  5.   

    if (not ADOQuery1.Recordset.EOF) and (not ADOQuery1.Recordset.bOF) then
                    Application.MessageBox('登陆成功!','提示信息',mb_ok)
            else
                    Application.MessageBox('您输入的用户名或密码错误,请检查!','提示信息',mb_ok);
      

  6.   

    自己解决了
    sql用select count(*) as aaa from mytable
    用adoquery1.fieldbyname('aaa').as integer取得记录数,再判断