Page 1 of 1

Creating MyDAC components at runtime

Posted: Fri 24 Feb 2006 00:21
by LarryEvilsizer
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

Posted: Fri 24 Feb 2006 08:12
by Antaeus
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);

Posted: Fri 24 Feb 2006 15:11
by LarryEvilsizer
Thanks, Antaeus. That worked like a charm!

Larry