• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Delphi之Exception获得错误信息(简单好理解)Delphi之Exception获得错误信息 ...

原作者: [db:作者] 来自: [db:来源] 收藏 邀请
Delphi之Exception获得错误信息

 

相关资料:

http://www.cnblogs.com/hackpig/archive/2010/02/15/1668547.html

 

实例代码:

 1 unit Unit1;
 2 
 3 interface
 4 
 5 uses
 6   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
 7   Dialogs, StdCtrls;
 8 
 9 type
10   TForm1 = class(TForm)
11     Button1: TButton;
12     procedure Button1Click(Sender: TObject);
13   private
14     { Private declarations }
15   public
16     { Public declarations }
17   end;
18 
19 var
20   Form1: TForm1;
21 
22 implementation
23 
24 {$R *.dfm}
25 
26 procedure TForm1.Button1Click(Sender: TObject);
27 var
28   int1: Integer;
29 begin
30   try
31     int1 := StrToInt('A');
32   except
33     ShowMessage(Exception(ExceptObject).Message);
34   end;
35 end;
36 
37 end.

 

PS:

try
DataModule1.PHBADOQuery2.ExecSQL ;
except
on e:exception do
begin
ShowMessage(e.Message);
end;
end;

try
int1 := StrToInt('A');
except
ShowMessage(Exception(ExceptObject).Message);
end; 

try
except
end;

try
finally
end;

http://www.cnblogs.com/FKdelphi/p/6281559.html

 

相关资料:

http://www.cnblogs.com/hackpig/archive/2010/02/15/1668547.html

 

实例代码:

 1 unit Unit1;
 2 
 3 interface
 4 
 5 uses
 6   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
 7   Dialogs, StdCtrls;
 8 
 9 type
10   TForm1 = class(TForm)
11     Button1: TButton;
12     procedure Button1Click(Sender: TObject);
13   private
14     { Private declarations }
15   public
16     { Public declarations }
17   end;
18 
19 var
20   Form1: TForm1;
21 
22 implementation
23 
24 {$R *.dfm}
25 
26 procedure TForm1.Button1Click(Sender: TObject);
27 var
28   int1: Integer;
29 begin
30   try
31     int1 := StrToInt('A');
32   except
33     ShowMessage(Exception(ExceptObject).Message);
34   end;
35 end;
36 
37 end.

 

PS:

try
DataModule1.PHBADOQuery2.ExecSQL ;
except
on e:exception do
begin
ShowMessage(e.Message);
end;
end;

try
int1 := StrToInt('A');
except
ShowMessage(Exception(ExceptObject).Message);
end; 

try
except
end;

try
finally
end;


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Matlab画图-非常具体,非常全面发布时间:2022-07-18
下一篇:
MatLab中函数图形的绘制发布时间:2022-07-18
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap