Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » SQL Anywhere Server - Programming » SQL Anywhere .NET Data Provider

Registering the SQL Anywhere .NET Data Provider DLL Next Page

.NET 2.0 tracing support

The SQL Anywhere ADO.NET 2.0 provider supports tracing using the .NET 2.0 tracing feature. Note that tracing is not supported on Windows CE.

By default, tracing is disabled. To enable tracing, specify the trace source in your application's configuration file. Here's an example of the configuration file:

<?xml version="1.0" encoding="utf-8" ?>
 <source name="iAnywhere.Data.SQLAnywhere" 
   <add name="ConsoleListener" 
   <add name="EventListener" 
   <add name="TraceLogListener" 
        traceOutputOptions="ProcessId, ThreadId, Timestamp"/>
   <remove name="Default"/>
 <add name="SASourceSwitch" value="All"/>
 <add name="SATraceAllSwitch" value="1" />
 <add name="SATraceExceptionSwitch" value="1" />
 <add name="SATraceFunctionSwitch" value="1" />
 <add name="SATracePoolingSwitch" value="1" />
 <add name="SATracePropertySwitch" value="1" />

The trace configuration information is placed in the application's bin\debug folder under the name app.exe.config.

The traceOutputOptions that can be specified include the following:

You can limit what is traced by setting specific trace options. By default the trace option settings are all 0. The trace options that can be set include the following:

To illustrate application tracing, we will use the TableViewer sample.

To configure an application for tracing
  1. You must use .NET 2.0. Tracing is not supported in .NET 1.x.

    Start Visual Studio 2005 and open the TableViewer project file (TableViewer.sln) in samples-dir\Samples\SQLAnywhere\ADO.NET\TableViewer.

  2. As distributed, this application uses .NET 1.0. To convert it to .NET 2.0, open up the References folder in the Solution Explorer pane.

  3. Right-click iAnywhere.Data.SQLAnywhere and select Remove. This removes the .NET 1.0 provider from the project.

  4. Right-click References and select Add.

  5. From the .NET tab of the Add References dialog, select iAnywhere.Data.SQLAnywhere with a Runtime version of 2.0.xxxxxx.

  6. Click OK.

  7. Place a copy of the configuration file shown above in the application's bin\debug folder under the name TableViewer.exe.config.

  8. From the Debug menu, select Start Debugging.

When the application finishes execution, you will find a trace output file in samples-dir\Samples\SQLAnywhere\ADO.NET\TableViewer\bin\Debug\myTrace.log.

Please note that tracing is not supported on Windows CE.

For more information, see "Tracing Data Access" at [external link]