Debugging dbExpress Applications using TSQLMonitor

From RAD Studio
Jump to: navigation, search

Go Up to Using dbExpress

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

  1. Choose File > New > Other. The New Items dialog appears.
  2. In the New Items dialog, select Delphi Projects and double-click VCL Forms Application.The Windows Designer displays.
  3. To monitor SQL commands, from the dbExpress category of the Tool Palette, drag a TSQLMonitor component to the form.
  4. Set the SQLConnection property of the TSQLMonitor to the TSQLConnection component.
  5. Set the Active property of the TSQLMonitor to True.

To use a callback to monitor SQL commands

  1. Use the SetTraceEvent method of the TSQLConnection component.
  2. 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.

See Also