Instead of tracing all database commands from the start of a database connection, you can start and end a trace programmatically for specific database queries. To start a trace, you can assign the string value pair “PBTrace=1” to the transaction object DBParm property; to end a trace, you assign the string value pair “PBTrace=0”.
For example, if you wanted data to be logged to the trace output for a single retrieve command, you could disable tracing from the start of the connection and then surround the retrieve call with DBParm property assignments as follows:
SQLCA.DBMS = "TRACE ODBC"
SQLCA.DBParm="PBTrace=0"
Connect using SQLCA;
...
SQLCA.DBParm="PBTrace=1"
dw_1.Retrieve ( )
SQLCA.DBParm="PBTrace=0"
When you first connect to a database after setting the DBMS parameter to “Trace DBMSName”, a configuration dialog box displays. The configuration parameters that you set in this dialog box are saved to the registry. Configuration parameters are retrieved from the registry when you begin tracing by assigning the DBParm parameter to "PBTrace=1".
You can start and stop the SQL statement trace utility in the same way if you set the DBMS value to “TRS DBMSName” instead of “Trace DBMSName”. For information about the SQL statement trace utility, see “Using the SQL statement trace utility”.