Subject | Re: [IBO] catching excpetion in TIB_Connection.Connect |
---|---|
Author | Ryan Nilsson-Harding |
Post date | 2002-09-23T22:43:29Z |
> There's an example in the Contact sample app. Here's the handler:TIB_Connection);
>
> procedure TdmContact.cnContactBeforeConnect(Sender:
> beginHi Helen, thanks for the reply.
> // Dynamically create the sample GDB if it does not exist.
> if ( cnContact.Protocol = cpLocal ) and
> not FileExists( cnContact.Database ) then
> scContact.Execute;
> end;
>
> Helen
I actually was using your suggested code originally, after I had a
look through the contact example, but it is not suitable for
creating the db remotely, as there is no way to tell if the file
exist (unless the path is shared, which it is not).
So I try to connect to the db (remotely), and if a file_not_found
exception occurs, I call the code to create the db.
This all worked fine when I had LoginPrompt false, and I was
assigning the uname & pwd in the beforeConnect event. But this is
only during development.
I want to supply my own login prompt (which I already have) but when
loginPrompt is True, my except block after my .Connect statement,
does not catch the exception anymore, even though the exception is
still thrown.
I would like to know why my exception block doesn't catch
the .connect statement when I have LoginPrompt = True, but it does
when the loginPrompt is False.
It doesn't seem to make sense to me.
Rgds,
-Ryan