Page 1 of 1

Tmyconnection VS Tcustommyconnection

Posted: Thu 11 Aug 2011 10:03
by andrea.m86
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!

Posted: Thu 11 Aug 2011 12:18
by AndreyZ
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);

Posted: Fri 12 Aug 2011 13:30
by andrea.m86
Ok! Thanks.