Debugging dbExpress Applications using TSQLMonitor
Go Up to How To Perform Database Procedures
While you are debugging your database application, you can monitor the SQL messages that are sent to and from the database server through your connection component, including those that are generated automatically for you (for example by a provider component or by the dbExpress driver).
To debug dbExpress applications
- Choose File > New > Other. The New Items dialog appears.
- In the New Items dialog, select Delphi Projects and double-click VCL Forms Application.The Windows Designer displays.
- To monitor SQL commands, from the dbExpress category of the Tool Palette, drag a TSQLMonitor component to the form.
- Set the SQLConnection property of the TSQLMonitor to the TSQLConnection component.
- Set the Active property of the TSQLMonitor to True.
To use a callback to monitor SQL commands
- Use the SetTraceEvent method of the TSQLConnection component.
- Set the TDBXTraceEvent event parameter.
The dbExpress driver triggers the event every time the SQL connection component passes a command to the server or the server returns an error message.
Warning: Do not call SetTraceEvent if the TSQLConnection object has an associated TSQLMonitor component. TSQLMonitor uses the callback mechanism to work, and TSQLConnection can only support one callback at a time.