注册 登录
编程论坛 Delphi论坛

delphi

abc0595 发布于 2007-05-10 10:55, 549 次点击

Function TForm1.My_Execute(id:integer;cstr:string;ADOQuery:TADOQuery):integer;
Begin
result:=0;
Try
ADOQuery.Close;
ADOQuery.SQL.Text :=cstr;
If id=0 Then ADOQuery.Open;
If id=1 Then Begin
ADOQuery.ExecSQL;
End;
Except
on E:exception Do Begin
showmessage(e.Message);
result:=1;
End;
End;
End;这段中,怎么理解阿,特别是这一句,on E:exception Do Begin
请大家帮帮忙,

1 回复
#2
nongen2007-05-10 12:09

An exception handler can specify an identifier before the name of the exception class. This declares the identifier to represent the exception object during execution of the statement that follows on...do. The scope of the identifier is limited to that statement. For example,

try
...
except
on E: Exception do ErrorDialog(E.Message, E.HelpContext);
end;

1