如何错误处理! try //do your self except //出错处理 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 try dt:=date; datetimetostring(tmpstr , 'yyyy-mm-dd' , dt); adoq_pubf1.Connection:=datamodule2.ADOCon_pubf; adoq_pubf1.SQL.Clear; adoq_pubf1.SQL.Add('insert into sys_log '); adoq_pubf1.sql.Add(' values('+tmpstr+','); adoq_pubf1.sql.Add(' '''+uid+''', '); adoq_pubf1.sql.Add(' '''+event+''','); adoq_pubf1.sql.Add(' '''+memo+''') '); rt:=adoq_pubf1.execsql; except on EDatabaseError do showmessage('数据库操作失败,请检查数据!'); end;但还是出现了系统的错误提示!!!(这是一个函数的内容) tryexcept//你的出错提示。end;或者unit Unit1;interfaceuses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, AppEvnts;type TForm1 = class(TForm) ApplicationEvents1: TApplicationEvents; procedure ApplicationEvents1Exception(Sender: TObject; E: Exception); private { Private declarations } public { Public declarations } end;var Form1: TForm1;implementation{$R *.DFM}procedure TForm1.ApplicationEvents1Exception(Sender: TObject; E: Exception);begin showmessage('数据库操作失败,请检查数据!');任何出错都会到这里来。end;end. function f_syslog(uid :string ; event:string ; memo :string):boolean; var dt:TDateTime; tmpstr:string; adoq_pubf1:TADOQuery; begin adoq_pubf1:=TADOQuery.Create(nil); try dt:=date; datetimetostring(tmpstr , 'yyyy-mm-dd' , dt); adoq_pubf1.Connection:=datamodule2.ADOCon_pubf; adoq_pubf1.SQL.Clear; adoq_pubf1.SQL.Add('insert into sys_log '); adoq_pubf1.sql.Add(' values('+tmpstr+','); adoq_pubf1.sql.Add(' '''+uid+''', '); adoq_pubf1.sql.Add(' '''+event+''','); adoq_pubf1.sql.Add(' '''+memo+''') '); except on EDatabaseError do showmessage('数据库操作失败,请检查数据!'); end;上面各位的方法我都已经试了没效果!这是完整的代码段!请帮忙分析,为什么会有这种不出提示框的问题?!!! 有个基础的问题 delphi 找工作 我要哭了,一直没有办法,也没人理我,treeview问题 我如何才能在DELPHI下面看到VCL的源代码呢? 《网络吸管》开发手记1 最大公约数函数? 悬赏100分求最优ACCESS数据库备份和压缩函数。(这么多分不要白不要了) 快活DIY开发者之梦-梦起-创业计划书 仿QQ,MSN TQ skype 等即时通讯源代码下载 十万火急啊,delphi的QReport怎么对分组后的每组内容进行排序?? filter 问题1 delphi能不能开发asp程序?
dt:=date;
datetimetostring(tmpstr , 'yyyy-mm-dd' , dt);
adoq_pubf1.Connection:=datamodule2.ADOCon_pubf;
adoq_pubf1.SQL.Clear;
adoq_pubf1.SQL.Add('insert into sys_log ');
adoq_pubf1.sql.Add(' values('+tmpstr+',');
adoq_pubf1.sql.Add(' '''+uid+''', ');
adoq_pubf1.sql.Add(' '''+event+''',');
adoq_pubf1.sql.Add(' '''+memo+''') ');
rt:=adoq_pubf1.execsql;
except
on EDatabaseError do showmessage('数据库操作失败,请检查数据!');
end;但还是出现了系统的错误提示!!!(这是一个函数的内容)
//你的出错提示。
end;或者unit Unit1;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
AppEvnts;type
TForm1 = class(TForm)
ApplicationEvents1: TApplicationEvents;
procedure ApplicationEvents1Exception(Sender: TObject; E: Exception);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.DFM}procedure TForm1.ApplicationEvents1Exception(Sender: TObject;
E: Exception);
begin
showmessage('数据库操作失败,请检查数据!');任何出错都会到这里来。
end;end.
var
dt:TDateTime;
tmpstr:string;
adoq_pubf1:TADOQuery;
begin
adoq_pubf1:=TADOQuery.Create(nil);
try
dt:=date;
datetimetostring(tmpstr , 'yyyy-mm-dd' , dt);
adoq_pubf1.Connection:=datamodule2.ADOCon_pubf;
adoq_pubf1.SQL.Clear;
adoq_pubf1.SQL.Add('insert into sys_log ');
adoq_pubf1.sql.Add(' values('+tmpstr+',');
adoq_pubf1.sql.Add(' '''+uid+''', ');
adoq_pubf1.sql.Add(' '''+event+''',');
adoq_pubf1.sql.Add(' '''+memo+''') ');
except
on EDatabaseError do showmessage('数据库操作失败,请检查数据!');
end;上面各位的方法我都已经试了没效果!这是完整的代码段!请帮忙分析,为什么会有这种不出提示框的问题?!!!