if Query1.RecordCount=0 then showmessage('没有返回值')
else showmessage(InttoStr(Query1.RecordCount));

解决方案 »

  1.   

    if Query.RecordCount = 0 then
      ShowMessage('no record');
      

  2.   

    有多种方式的:
    1、if query.recordcount<=0 then showmessage('没有返回值');
    2、if query.eof then showmessage('没有返回值');
    第二种方法性能要好一些,尤其是有返回值的情况。
      

  3.   

    if Query1.IsEmpty then
      showmessage('没有返回值');
    不要用RecordCount!
      

  4.   

    select tt=isnull(aa,0) from tablename
    aa为字段名
    判断tt值是否为0;