delphi7下写的使用interbase7数据库的程序运行是正常的(在IB7启动好时)但没起来时我在数据库表里用
try
...
finally
...
end
和try
...
except
...
end
都抓不住错误系统提示错误时raise EDBEngineError并且IDAPI service library找不到我自己程序里如何抓住并能处理该异常啊?

解决方案 »

  1.   

    首先编一个异常处理过程: 
    procedure TForm1.MyException(Sender: TObject; E: Exception); 
    begin 
      if (E is EDatabaseError) then//数据库类异常 
      begin 
        Beep; //发出声响,提示用户 
        ShowMessage(E.Message)//弹出对话框提示错误信息 
      end 
      else//不是数据库类错误 
      begin 
        ShowMessage(E.Message);//显示错误信息 
        Application.Terminate;//异常退出 
      end; 
    end; 再把这个处理过程挂到Application对象上。这步通常是在FormCreate事件里完成 
    的: 
    procedure TForm1.FormCreate(Sender:TObject) 
    begin 
    Application.OnException:=MyException;//挂上异常处理过程 
    end;