Tmyconnection VS Tcustommyconnection

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
andrea.m86
Posts: 25
Joined: Thu 26 May 2011 10:36

Tmyconnection VS Tcustommyconnection

Post by andrea.m86 » Thu 11 Aug 2011 10:03

Hi,
This is my problem: I need to connect a tmymetadata object to a Tmyconnection object, but i have to do this at runtime and I don't know which of the Tmyconnection I've already created will be chosen.
The problem is that i get the tmyconnection from a Tmyquery object.
When i try to set the connection with this statement
mymetadata1.connection := myquery1.connection;
i get an error because i'm trying to put in a Tmyconnection object a Tcustommyconnection object.
How can i do that?
why there are two kind of class Tmyconnection and Tcustommyconnection?
and why in tmyconnection i can set the PORT and in tcustommyconnection there isn't this parameter?
thanks!

AndreyZ

Post by AndreyZ » Thu 11 Aug 2011 12:18

Hello,

Thank you for the information. We will change the TMyMetaData.Connection property to return TCustomMyConnection in the next MyDAC build. There are two kinds of connection that can be used: TMyConnection and TMyEmbConnection. In order to work with any of these kinds of connection, all MyDAC components use TCustomMyConnection. Both TMyConnection and TMyEmbConnection are inherited from TCustomMyConnection.
As a workaround, you can use the following code:

Code: Select all

MyMetaData1.Connection := TMyConnection(MyQuery1.Connection);

andrea.m86
Posts: 25
Joined: Thu 26 May 2011 10:36

Post by andrea.m86 » Fri 12 Aug 2011 13:30

Ok! Thanks.

Post Reply