判断TQuery 的属性RecordCount是否为0,
不是为零则找到。

解决方案 »

  1.   

    执行select * from 表 where 条件语句后,判断query1.IsEmpty若为false则成功找到符合条件的记录,若query1.IsEmpty为true则未找到符合条件的记录。
      

  2.   

    if Query1.Eof And Query1.Bof then//没有找到记录
    else//找到记录
      

  3.   

    以上方法都不错,我常用halfdream的方法
      

  4.   

    RecordCount不是很行
    最好用ISEMPTY
      

  5.   

    怎么会呢,recordcount很好用啊!
      

  6.   

    在本地数据库,用Recordcount的确好用,但是在远端数据库就不灵了。
    with query1 do
     begin
      close;
      sql.clear;
      sql.add('select count(*) from table1 where ....'); 
      open;
    end;if query1.fields[0].Asinteger>0 then
     begin
       messagedlg('找到了');
     end
    else
     begin
      messagedlg('他妈的,又没有找到!');
    end;