回 帖 发 新 帖 刷新版面

主题:Delphi 编译时遇到的一个问题,急!!! 求帮助。

procedure   TDM.DataModuleCreate(Sender:   TObject);   
  conn.ConnectionString   :=   '一些连接信息';   
  try   
          conn.Open;   
      except   
          on   Err   :   EOleException   do   
          begin   
              //做一些处理   
          end;   
      end;   
  end;   
  程序无法通过编译:错误提示是   
  [Error]   DBModule.pas(37):   Undeclared   identifier:   'EOleException'   
    
  当我去掉   on   Err:   EOleException   do   时,尝试conn.ConnectionString   录入错误的信息并登录,调试时又引发异常类EOleException.. 
 
  我不想用‘Exception’代替‘EOleException’!!! 
    
  请问各位要怎样解决这个问题?

回复列表 (共4个回复)

沙发

Undeclared   identifier:   'EOleException'   没有定义...你试下在前面定义看看.

板凳

XIAN YONG  var  DENG YI YI XIA

3 楼

EOleException is the exception class for OLE automation errors that occur in methods or properties of an object.

Unit

ComObj

Description

EOleException is the exception class for errors specific to the OLE IDispatch interface. EOleException is raised when an error occurs in the middle of a method call from IDispatch. EOleException is generated when a Delphi server receives a failure return value from a property or method that was called with the IDispatch interface Invoke method.

When an error occurs, objects invoked through IDispatch can return essential information about the exception, including the source of the error, error code, description, help file, and ID number for context-sensitive help. EOleException captures this information, and the error description and ID number (if available) are included in a message generated by CreateHelp; the other information is stored in the Source and HelpFile properties defined for EOleException and the ErrorCode property inherited from EOleSysError.
看一下DELPHI的帮助就知道了。

4 楼


3楼你说的只是发生异常的现象,你能不能说说解决方法啊?
我也是初学者,也经常碰到一些类似的问题,还请你不吝赐教!!谢谢

我来回复

您尚未登录,请登录后再回复。点此登录或注册