Query1.SQL.Add('...');
Query1.Open;
if Query1.RecordCount>0 then
  ShowMessage('找到 '+inttostr(Query1.RecordCount)+' 个');

解决方案 »

  1.   

    放个数据敏感控件(比如DBGrid)在Form上,设置好参数,
    SQL.Add('select ecode from aaa where ecode='+Chr(39)+Edit1.text+Chr(39));
    Open;
      给分!
      

  2.   

    zxtyhy(地图鱼) 方法可行
    但要注意BDE连接ms sql 时有时Query1.RecordCount返回值不准。
    具体的帖子请见:
    http://www.csdn.net/expert/topic/96/96922.shtm
      

  3.   

    devecom(同一类人):
    什么意思?
      

  4.   

    我的目的是:如果查到有这条数据,我就要进行修改操作了,如果没有找到就提示“无这个员工”,那比较可靠而简便的方法是什么呢?我不想再加一个dbgrid.
      

  5.   

    sql.add('select * from aaa where ecode='''+edit1.text+'''),
    open;
    if query1.eof and query1.bof then 
       “无这个员工”
    else
        modify  it
      

  6.   

    sql.add('select ecode from aaa where ecode='''+edit1.text+''')可以用加参数的形式(地图鱼)的方法我也同意,可以用返回记录数(RecodeCount)的方法来判断是否找到