Hello,
I am currently working developoning C++ app. with the codeGear Ide.
I want to keep trace of every stored procedure I call using ADO executeComplete event in my ADO connection object (just for loging propourses). My problem is that I can not access any Command property because of const statement in the event prototype just before _Command.
void __fastcall TDm::ADOCnnClientesExecuteComplete(TADOConnection *Connection,
int RecordsAffected, const Error *Error, TEventStatus &EventStatus,
const _Command *Command, const _Recordset *Recordset)
{
}
Is there any option to access Command properties (like parameteres names, values, etc. inside this event handler?
First, tried to upcast, but it didn´t work
void __fastcall TDm::ADOCnnClientesExecuteComplete(TADOConnection *Connection,
int RecordsAffected, const Error *Error, TEventStatus &EventStatus,
const _Command *Command, const _Recordset *Recordset)
{
TADOCommand *ADOCmd;
ADOCmd = (TADOCommand*) Command;
}
Then I tried to use directly _Command:
void __fastcall TDm::ADOCnnClientesExecuteComplete(TADOConnection *Connection,
int RecordsAffected, const Error *Error, TEventStatus &EventStatus,
const _Command *Command, const _Recordset *Recordset)
{
String strCmd;
Command->Get_CommandText(strCmd); //strCmd is passed as a reference
}
But Complains Get_CommandText is not a const member function!!
This is actually the problem. In other ADO implementations (.NET or VC++) the event does not have const just in front of _Command
//also tried to create a new Command Object from scratch.
void __fastcall TDm::ADOCnnClientesExecuteComplete(TADOConnection *Connection,
int RecordsAffected, const Error *Error, TEventStatus &EventStatus,
const _Command *Command, const _Recordset *Recordset)
{
TADOCommand *ADOCmd2 = new TADOCommand (NULL);
ADOCmd2->CommandObject = Command; //
}
This time i get Cannot convert 'const _Command *' to '_di__Command'
Well, actually I really don´t understand the diference between _Command and TADOCommand. I think, TADOCommand should be some kind of wrapper for the ADO.Command COM object
Thanks in advance (sorry if my english is not good enough)