As already suggested here , you can use the TAdoConnection.OnWillExecute event to send requests to the console, for example:
procedure TDataModuleProd.ADOConnection1WillExecute( Connection: TADOConnection; var CommandText: WideString; var CursorType: TCursorType; var LockType: TADOLockType; var CommandType: TCommandType; var ExecuteOptions: TExecuteOptions; var EventStatus: TEventStatus; const Command: _Command; const Recordset: _Recordset); begin {$ifdef DEBUG} OutputDebugString(PChar('SQL Execute: ' + CommandText)); {$endif} end;
source share