如何错误处理! 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中怎么接收flash中fscommand发出的命令? 如何琐定桌面的鼠标,不让他动。 给TListView的OnDblClick事件编写代码时,怎么得到哪个TListItem被双击了 请教如何建立access多重索引表啊??? 关于dbcombobox的问题 问一个简单算法的思路(指派问题) 关于paintbox的问题! 关于深入IE编程的几个问题,给分200!! 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;上面各位的方法我都已经试了没效果!这是完整的代码段!请帮忙分析,为什么会有这种不出提示框的问题?!!!