How to handle logon failures using the connection dialog

How to handle logon failures using the connection dialog

Postby Hans » Wed 28 Dec 2005 22:51

Hi,

I Use TMyConnection and TMyConnectionDialog. i copied the exacmple MyDACConnectForm. I just donot understand how it works. I have set the dialog class and when I start my application the expected custom logon dialog appears. So far so good.

But, why does the dialog appear automatically? AND how do I handle logon errors. When I donot enter a password I get an error message (EDatabase Error) and the retry mechanism does not work. Then the application crashes and I get a windows error (Windows encountered a problem ...)

Does somebody have a working example for this please?

best regards,
hans
Hans
 
Posts: 52
Joined: Wed 24 Aug 2005 20:05

Postby Ikar » Thu 29 Dec 2005 12:29

> But, why does the dialog appear automatically?

Most possible you have connected to server from design-time. You can avoid this problem by setting MyConnection.Connected to False. Also you can set MyConnection.Options.KeepDesignConnected to False.

> AND how do I handle logon errors.

Use MyConnection.OnError event handler or overwrite TfmMyConnect.DoConnect method.
Ikar
 
Posts: 1693
Joined: Thu 28 Oct 2004 13:56


Return to MySQL Data Access Components