Autor Beitrag
the_immortal
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 78



BeitragVerfasst: Mo 17.10.05 12:32 
Ich habe ein Connection (Zeolib) mit welcher ich versuche zu connecten.

Ist der MySQL-Server offline bekomme ich eine Exception 'MySQL could not connect to...'

Wie kann ich diese Exception abfangen?


Ich habe es wie folgt versucht, jedoch ohne Erfolg:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
  try
    Conn1.Connect;
  finally
    showmessage('finnaly');
  end;
OlliWausD
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 212

Win 2000/XP
Delphi 5 Professional - Interbase/Firebird
BeitragVerfasst: Mo 17.10.05 16:11 
hallo,

Try-Finally Anweisungen geben die Fehlermeldung nach abarbeitung des Try-Blockes zurück.

was du brauchst ist eine Try-Except Anweisung

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
  try  
    Conn1.Connect;  
  Except
    showmessage('Fehlermeldung unterbunden');  
  end;


mfg

Olli W

_________________
Take it easy
the_immortal Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 78



BeitragVerfasst: Mo 17.10.05 16:12 
user profile iconOlliWausD hat folgendes geschrieben:
hallo,

Try-Finally Anweisungen geben die Fehlermeldung nach abarbeitung des Try-Blockes zurück.

was du brauchst ist eine Try-Except Anweisung

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
  try  
    Conn1.Connect;  
  Except
    showmessage('Fehlermeldung unterbunden');  
  end;


mfg

Olli W


Habe ich versucht, funktioniert auch nicht!
rstaeker
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 94

WIN 2000
D6 Prof
BeitragVerfasst: Di 18.10.05 16:00 
Wenn Du das Programm in der IDE ausführst, kommt die Fehlermeldung immer.
Starte die Exe mal direkt, dann müsste der Fehler eigentlich abgefangen werden.

Zumindest bei mir.

MfG Rene

Edit: Es gibt für die IDE glaub ich einen bestimmten Compilerschalter, bin mir aber nicht sicher und müsste auch zuhause erst nachschauen.