adoconnection断线重连
adoconnection断线重连
通过捕获数据库断连的异常,实现重连。
procedure TForm1.ApplicationEvents1Exception(Sender: TObject;
E: Exception);
begin
if (ADOConnection1.Errors.Count > 0) and (ADOConnection1.Errors.Item[0].Number = -2147467259) then
begin
ADOConnection1.Close;
ADOConnection1.Open;
end;
end;
本文来自博客园,作者:{咏南中间件},转载请注明原文链接:https://www.cnblogs.com/hnxxcxg/p/12418507.html