I have a TADOConnection object in a form connected to a SQLServer database.
When I try to open the object:
if (!ADOConnection->Connected) ADOConnection->Open();
CodeGuard shows this error (I compiled with full debug in Borland C++ Builder 6 and also with C++ Builder 2007 with the same problem):
Method called on illegally casted object
Attempt to access 224 byte(s) at 0x010C2460. The 'this' pointer points to heap block 0x010C2460 which is only 220 bytes long.
0x010C2460
-Adodb::TADOConnection::Open()
-TForm1::TForm1(Classes::TComponent *)
-TFormulario::Button3Click(const System::TObject *)
-0x004EF1F2
-0x004F20CC
-Controls::_16864 + 0x28
The memory block (0x010C2460) [size: 220 bytes] was allocated with SysGetMem
-System::__linkproc__ GetMem + 0xB
-0x004855EA
-0x00485836
-0x00485775
-Classes::TComponent::ReadState + 0x6
-0x004D9D92
I've found a solution: Comment this line and when I open the TADODataSet (TADODataSet->Connection=TADOConnection) it opens both without error.
My question is Why I cannot open the TADOConnection without CodeGuard error?
There is a bug in the TADOConnection VCL object?
Thanks in advance
Oscar