Page 1 of 1
MSConnectDialog1
Posted: Wed 05 Nov 2014 16:04
by Moondancer
Why does clicking 'Cancel' in the dialog window not close the application ? I have :
Code: Select all
procedure TDataModule2.DataModuleCreate(Sender: TObject);
begin
MSConnection1.Connect;
end;
Dialog window shows ok but if I click 'cancel' I still get the dialog window again for every table I have. Sorry, new to this ....
Re: MSConnectDialog1
Posted: Thu 06 Nov 2014 09:34
by AlexP
hello,
When trying to open DataSet when disconnected, there occurs an attempt to establish a connection, therefore ConnectDialog is opened. You can implement your ConnectDialog providing the behavior you need. You can find a sample of implementation in ..\Devart\SDAC for ...\Demos\SDACDemo\ConnectDialog\
Re: MSConnectDialog1
Posted: Thu 06 Nov 2014 16:27
by Moondancer
I dont need my own login dialog. I should be happy with one supplied. But the problem is you cant do anything with it. Just with the connection. So is there a nice,simple example of normal connection using your dialog ?
Re: MSConnectDialog1
Posted: Fri 07 Nov 2014 09:03
by AlexP
If you just need to close the application if in ConnectDialog the Cancel button is pressed, you can use the following code to close the application:
Code: Select all
begin
if not MSConnectDialog1.Execute then
close;
end;
Re: MSConnectDialog1
Posted: Sat 08 Nov 2014 14:36
by Moondancer
Your MSConnectDialog1,it seems,is 'wired' to trigger the connection by itself.
I cant open tables on AfterConnect event because just browsing the databases
in the MSConnectDialog1 - Database window, triggers an error.It seems the
MSConnectDialog1 assumes the connection is already established. It would be nice
to open the tables on after connect but it seems it cant be done.
If I do :
Code: Select all
procedure TDataModule2.DataModuleCreate(Sender: TObject);
begin
if not MSConnectDialog1.Execute then
Application.Terminate;
end;
the application,before closing, tries to show the main form.
So you have kind of a jerk.
Re: MSConnectDialog1
Posted: Mon 10 Nov 2014 10:26
by AlexP
To retrieve the list of available databases on the server, an established connection is required. Therefore a connection is established on an attempt to open the database list.
The form is showed due to the fact that forms are created independently on the MSConnectDialog1.Execute method execution result. You should change the logic of forms creation taking into account the result returned by this method.