语句如下
  with SubQuery do
  begin
    DatabaseName := MSG_DBName;             //根据ID 到数据库中查找
    Close;
    SQL.Clear;
    SQL.Add('select * from app_marriage');
    SQL.Add(format('where id = %d',[myId]));    Open;
  end;  if Eof then                    
  begin                       //  没有记录 说明用户发送的ID不正确    Result := '对不起,您查询的ID不存在,暂时不能为您提供服务';  end
  else
  ....在 if eof then 这一句报错
报错信息是
exception class EInOutError with message 'I/O error 6'.不知道是什么意思 
请高手指教

解决方案 »

  1.   

    with SubQuery do
      begin
        DatabaseName := MSG_DBName;             //根据ID 到数据库中查找
        Close;
        SQL.Clear;
        SQL.Add('select * from app_marriage ');
        SQL.Add(format('where id = %d',[myId]));    Open;
      end;
    加一个空格试验一下!可能是SQL语句的问题!看看吧!
      

  2.   

    错了!IF RECORDCOUNT =0 看看能不能判断!
      

  3.   

    把if循环放到with do的结构中就可以了。
      

  4.   

    哦 可以了 谢谢  doubhua(豆瓣花)  
      

  5.   

    with SubQuery do
      begin
        DatabaseName := MSG_DBName;             //根据ID 到数据库中查找
        Close;
        SQL.Clear;
        SQL.Add('select * from app_marriage');
        SQL.Add(format('where id = %d',[myId]));    Open;
      if Eof then                    
      begin                       //  没有记录 说明用户发送的ID不正确    Result := '对不起,您查询的ID不存在,暂时不能为您提供服务';  end
      else
      ....
      end;
      

  6.   

    SQL.Add('select * from app_marriage');
        SQL.Add(format('where id = %d',[myId]));
    ===
    先把 format('where id = %d',[myId])放到一变量去,再SQL.Add看看如何