其他分享
首页 > 其他分享> > Delphi ADOConnection 捕捉错误

Delphi ADOConnection 捕捉错误

作者:互联网

procedure TForm1.con1ExecuteComplete(Connection: TADOConnection;
RecordsAffected: Integer; const Error: Error;
var EventStatus: TEventStatus; const Command: _Command;
const Recordset: _Recordset);
begin
mmo1.Lines.Add('con1ExecuteComplete');
if Error = nil then
EXIT;
if Error.SQLState = '08S01' then //连接失败 其他状态得去查一下资料才能做对应的处理
begin
Connection.Close;
Connection.Open;
end;
mmo1.Lines.Add('Source:'+Error.Source);
mmo1.Lines.Add('Description:'+Error.Description);
mmo1.Lines.Add('HelpFile:'+Error.HelpFile);
mmo1.Lines.Add('SQLState:'+Error.SQLState);
mmo1.Lines.Add(inttostr(Ord(EventStatus)));
end;

标签:const,mmo1,Delphi,Lines,Add,ADOConnection,捕捉,SQLState,Error
来源: https://www.cnblogs.com/BTag/p/16344024.html