Delphi查询返回的recordcount=-1的解决办法

June 10, 2009 | tags Delphi技巧   | views
Comments 0
Delphi查询返回的recordcount=-1的解决办法
---
来源:TTT BLOG [ http://www.taoyoyo.net/ttt/ ]
地址:http://www.taoyoyo.net/ttt/post/121.html
---

Delphi查询返回的recordcount=-1的解决办法
---
20090521 153400
---
有时,查询返回的recordcount=-1,总是-1,即使有记录也是这样,导致程序无法根据recordcount结果做出正确的反应。
原因不明,解决方法是:先定位到查询的开始,然后定位到最后,再判断recordcount。
如下:
    With dm.QR_ENNSHD_020 do begin
        close;
        ParamByName('NO_STD_NO').AsString:=edtNo_Std_No.Text;
        paramByName('VER_NO').AsString:=edtVer_No.Text;
        open;
        first;
        last;
        if recordcount<=0 then begin
            x_pMsg:='Data no found!';
            MessageDlg(x_pMsg,mtInformation,[mbOk],0);
            exit;
        end;

--本文来源于[TTT BLOG]:http://www.taoyoyo.net/ttt/post/121.html
(提示:转载时请务必保留此版权信息或者注明来源。)




发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。