Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread How To Check If DatabaseName Is Valid?
Tue, Aug 7 2018 7:01 PMPermanent Link

Frederick Chin

I am trying to check if a database name is valid by doing the following:-

try
  Database.DatabaseName:='dbname';
except
  <do something>
end;

If 'dbname' does not exist, EWB throws up its own error message instead of executing <do something>.

How do check if a database name is valid?

--
Frederick
Wed, Aug 8 2018 5:25 AMPermanent Link

Uli Becker

Frederick,

> I am trying to check if a database name is valid by doing the following:-
>
> try
>     Database.DatabaseName:='dbname';
> except
>     <do something>
> end;
>
> If 'dbname' does not exist, EWB throws up its own error message instead of executing <do something>.

Your exception handler doesn't work because there is no exception.
The exception you are seeing is thrown when a dataset is loaded. You
would have to create an OnLoadError handler and analyze the
ErrorMessage/ErrorCode.

Uli
Wed, Aug 8 2018 10:56 AMPermanent Link

Frederick Chin

Uli,

/*
Your exception handler doesn't work because there is no exception.
The exception you are seeing is thrown when a dataset is loaded. You
would have to create an OnLoadError handler and analyze the
ErrorMessage/ErrorCode.
*/

Thanks. The message was appearing later in the file.

I really miss the debugging features of Delphi.

--
Frederick
Image