Problem/info about TMSConnection and ConnectionString property

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Sergio Bertolotti
Posts: 54
Joined: Tue 02 May 2006 12:03
Location: Italy

Problem/info about TMSConnection and ConnectionString property

Post by Sergio Bertolotti » Fri 18 Apr 2008 15:04

Dear Support,

I use last version of SDAC 4.35.1.16 prof. with Delphi 2007 with last service pack.

I have this problem / question.

I use TMSConnection component. I set connectionString at designtime and all is OK.
I set options - KeepDesignConnected to false in TMSConnection component.
I connect a TMSQuery to this TMSConnection. After this I close my TMSConnection with method Disconnect.

When I open my TMSQuery, itself open my TMSConnection.

If I set connectionString := '' and open my TMSQuery at this point I can't open Connection and I obtain an error message.

At this point my question is : is it normal this behavior ?

How can I disconnect from my DB TMSConnection component ?

Best regards.

Sergio Bertolotti

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Mon 21 Apr 2008 09:31

You can disconnect using one of the following lines:

Code: Select all

  MSConnection.Disconnect;
  MSConnection.Close;
  MSConnection.Connected := False;
The KeepDesignConnected option has no sense at run time.
Setting the ConnectionString to an empty string just clears connection setting.

When you are trying to open a TMSQuery component linked to this connection, the connection automatically gets connected.
Last edited by Antaeus on Wed 23 Apr 2008 12:08, edited 1 time in total.

Sergio Bertolotti
Posts: 54
Joined: Tue 02 May 2006 12:03
Location: Italy

Post by Sergio Bertolotti » Tue 22 Apr 2008 10:06

Dear Antaeus,

many thank's for your answer.

Best regards.

Sergio Bertolotti

Post Reply