Home > Back-end >  Consult a DELPHI exception handling problem!
Consult a DELPHI exception handling problem!

Time:10-11


As shown above, I made a small tool,
Application opens, ADO connection SQL database, and then written into a data,
The question is, if the connection is not successful, the program as the above error,
Now I want to do an exception handling, such as:

Try
XXX, XXX.
Except,
Showmessage (' failure to connect to the database, the program exits');
Application. The Terminate;
end;

An error message so nice, don't know how to start... Know the try, but I don't know where it is put in...
Excuse me, have a friend to give directions? Thank you for the first

CodePudding user response:

Try to perform when ah, such as ADOquery1. Open, etc.
Try
ADOquery1. Open;
Except,
Showmessage (' failure to connect to the database, the program exits');
end;

CodePudding user response:

Try to perform when ah, such as ADOquery1. Open, etc.
Try
ADOquery1. Open;
Except,
Showmessage (' failure to connect to the database, the program exits');
end;

CodePudding user response:

Agree, ^_^...
  • Related