TZConnection Exception Handling
Posted: 06.08.2007, 12:11
I am trying to raise an exception when the database property of the connection is entered incorrectly. The application uses 2 databases, a test database and a production database. When the database name is entered incorrectly I get an error message (which is correct) but I want to customize the error message. The application throws the message with SQL Error -902 (also correct). My code is as follows:
[font=Courier New]conxApplication.Username := editUsername.Text;
conxApplication.Password := editPassword.Text;
conxApplication.Database := editDatabase.Text;
try
conxApplication.Connect
except on <?> do
begin
MessageDlg(‘You specified an incorrect database’,......);
editDatabase.SetFocus;
Exit;
end;[/font]
The <?> in the exception part is what I do not know. What are the exceptions that the TZConnection component can throw? And on an exception, how can I address the specific error code that is thrown by the exception?
I am using ZEOSLIB 6.6.1 Beta, Delphi 7 and Firebird 2.0.1
Any help would be great,
Many thanks in advance.
Antz
[font=Courier New]conxApplication.Username := editUsername.Text;
conxApplication.Password := editPassword.Text;
conxApplication.Database := editDatabase.Text;
try
conxApplication.Connect
except on <?> do
begin
MessageDlg(‘You specified an incorrect database’,......);
editDatabase.SetFocus;
Exit;
end;[/font]
The <?> in the exception part is what I do not know. What are the exceptions that the TZConnection component can throw? And on an exception, how can I address the specific error code that is thrown by the exception?
I am using ZEOSLIB 6.6.1 Beta, Delphi 7 and Firebird 2.0.1
Any help would be great,
Many thanks in advance.
Antz