Page 1 of 1

Issue when calling connect within form's oncreate event

Posted: Wed 01 Dec 2010 12:26
by swierzbicki
Hello,

Something is going wrong when calling MyConnection.Connect within the Form's OnCreate event :
Steps to reproduce :

Create a new VCL application
Drop a TMyConnection and a TMyConnectionDialog components

Double click on the form to generate an OnCreate Event
Fill the OnCreate Event with that :

Code: Select all

Myconnection1.Connect ;
If not(MyConnection1.Connected)
     then showmessage('Ohhh noooo');
compile and run the project
when the connection dialog appears hit CANCEL

Actually :
No message is displayed (no more code from the Event is execude)

Expected :
Message should be displayed (all code from the Event should be execude)

Do you know how to solves this ?

Ps : I'm using the latest MyDac comps 6.0.0.2

Posted: Thu 02 Dec 2010 08:57
by AlexP
Hello,

Thank you for the information.
We have reproduced the problem.
We are trying to resolve it.
Now you can use the following workaround:

try
Myconnection1.Connect ;
finally
If not(MyConnection1.Connected)
then showmessage('Ohhh noooo');
end;

Posted: Thu 02 Dec 2010 10:05
by bork
Hello

We have fixed this problem. This fix will be included in the next MyDAC build.

Posted: Fri 03 Dec 2010 09:19
by bork
Hello

We have analyzed this issue again. We cannot change this behavior because other our users use try...except block to catch situations when connection wasn't established. So you should use try...except or try...finally blocks to handle the "Cancel" button click.

Posted: Fri 03 Dec 2010 16:35
by swierzbicki
Hello,


when doing so, I don't know if the connection wasn't established because of network/authentification errors or because of user who hit Cancel button.

I also understand that an exception is raised when an errors occurs but I don't get why you raise a silent (EAbort) exception when a user click on Cancel ?

Posted: Tue 07 Dec 2010 08:22
by bork
Hello

I understand your issue and I agree with you. But we have a lot of users that are using the current behavior. We will try to find a solution for it.

Posted: Wed 08 Dec 2010 07:29
by swierzbicki
Thank you !