在一个表中用LOCATE定位一个符合条件的记录,如果在表中没有找到符合条件的记录,我想给用户一个提示,说明没有找到(定位到)符合条件的记录,怎么做啊?

解决方案 »

  1.   

    var
      TF: Bool;
    begin
      TF := ADOTable.Locate('Filed',fsafe);
      if TF then
       ShowMessage('查到.....');
    end;
    ...
      

  2.   

    LOCATE如果找到记录会返回true,否则返回false
    if not lacate(..) then
       showmessage('没有找到符合条件的记录')
      

  3.   

    function Locate(const KeyFields: string; const KeyValues: Variant; Options: TLocateOptions): Boolean; virtual;Returns false, indicating that a matching record was not found and the active record was not changed.
    Locate returns true if a record is found that matches the specified criteria and that record is now active.if not DataSet1.localte(...) then
      //说明没有找到(定位到)符合条件的记录
      

  4.   

    if not adoquery1.locate(字段,值) then
    showmessage('沒找到...');