Creating MyDAC components at runtime

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
LarryEvilsizer
Posts: 4
Joined: Fri 24 Feb 2006 00:13

Creating MyDAC components at runtime

Post by LarryEvilsizer » Fri 24 Feb 2006 00:21

Hi,

Please excuse this somewhat basic question - I come from a Java background where creating JDBC objects at run-time is OK and I was hoping to do the same with MyDAC.

When I try to create new TMyConnection and TMyQuery objects using the new operator, the compiler tells me there is no constructor for this operation. I guess I'm doing something wrong, but am not sure what it is.

I would appreciate any advice on how to create MyDAC objects at run-time. Thanks in advance.

Larry

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

Post by Antaeus » Fri 24 Feb 2006 08:12

I guess that you use CBuilder. To create MyDAC component you should use somethig like this:

Code: Select all

TMyQuery *MyQuery = new TMyQuery(NULL);
or

Code: Select all

TMyQuery *MyQuery = new TMyQuery(Form1);

LarryEvilsizer
Posts: 4
Joined: Fri 24 Feb 2006 00:13

Post by LarryEvilsizer » Fri 24 Feb 2006 15:11

Thanks, Antaeus. That worked like a charm!

Larry

Post Reply