MSConnectDialog1

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Moondancer
Posts: 9
Joined: Tue 10 Apr 2012 14:07

MSConnectDialog1

Post by Moondancer » Wed 05 Nov 2014 16:04

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 ....

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: MSConnectDialog1

Post by AlexP » Thu 06 Nov 2014 09:34

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\

Moondancer
Posts: 9
Joined: Tue 10 Apr 2012 14:07

Re: MSConnectDialog1

Post by Moondancer » Thu 06 Nov 2014 16:27

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 ?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: MSConnectDialog1

Post by AlexP » Fri 07 Nov 2014 09:03

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;

Moondancer
Posts: 9
Joined: Tue 10 Apr 2012 14:07

Re: MSConnectDialog1

Post by Moondancer » Sat 08 Nov 2014 14:36

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.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: MSConnectDialog1

Post by AlexP » Mon 10 Nov 2014 10:26

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.

Post Reply