怎样在程序中特别的触发一个异常!!我在程序中想人为的触发一个异常,怎么写代码
解决方案 »
- 请问谁有Delphi 5?
- 为什么try...except...end无法捕获异常
- 江湖救急——请问如何用程序改变FastReport里的字段列表的名字,
- 傻傻一问( about QReport and FastReport)
- datamodule1.DataSource1.Free之后?
- 菜鸟的问题:listindex out of bounds(2)是什么意思?看看吧,谢谢!
- 解决form闪动问题,解决后一定给分
- 数据库更新
- 求Delphi5企业版SP升级包下灾地址。另外问一下,装sp几比较好?
- TChromium控件中哪个属性是关闭GPU硬件加速的
- 烦恼中,散分。大伙给点建议
- 那里有汉化DELPHI6的软件下载
try
if (trim(dbedit8.Text)='') then
application.MessageBox('申请人不能为空,请重新输入','输入错误',mb_ok)
else
raise Ebad.create('some bad stuff happen');
except
table1.Post;
end;
具体看看delphi的帮助
if (trim(dbedit8.Text)='') then
application.MessageBox('申请人不能为空,请重新输入','输入错误',mb_ok)
else
table1.Post;
except
raise Exception.create('some bad stuff happen');
end;这样只是控制table1.Post;时的异常!
if (trim(dbedit8.Text)='') then
raise Exception.create('申请人不能为空,请重新输入');
table1.post ;
except
on e:Exception do
begin
application.MessageBox(e.message)
end
end;上面的代码,你感觉如何?