Ver Mensaje Individual
  #8  
Antiguo 01-08-2015
adripugliesso adripugliesso is offline
Miembro
NULL
 
Registrado: jul 2015
Posts: 49
Reputación: 0
adripugliesso Va por buen camino
SOLUCIONADO:

Agrege un TApplicationEvents y en USES ComObj;

y luego en el evento OnException del TApplicationEvents

Código Delphi [-]
procedure TForm1.ApplicationEvents1Exception(Sender: TObject;
  E: Exception);
var
  EO:EOLEException;
begin
  if E is EOLEException then
  begin
    EO:=EOLEException(E);
    if (EO.ErrorCode = -2147467259) then
      //error de conexion (disconnected)
      begin
        try
          try
            ADOConnection1.Close;
          except;
          end;
          ADOConnection1.Open;
          ShowMessage('FALLA EN LA CONEXION A LA BASE DE DATOS - Reestableciendo, vuelva a intentar!');
        except
          on E:Exception do
            ShowMessageFmt('FALLA EN LA CONEXION A LA BASE DE DATOS!.  '
            + 'Por favor, intente luego!.'#13'Error message: %s', [E.Message]);
          end;
      end
      else
        ShowMessage(E.Message + ' ' + IntToStr(EO.ErrorCode));
    end
  else
    ShowMessage(E.ClassName + #13 + E.Message);

end;
Responder Con Cita