Debugging

You can debug a custom OLE Automation server created by using 32-bit Visual Basic 4.0. To do this, Visual Basic must be installed on the SQL Server computer, and SQL Server must be running under the same Windows NT user account that Visual Basic is running under. So the SQL Server must be started from the command line and independent of the Windows NT Service Control Manager (by using the sqlservr /c command), or the SQL Server service must be started under the same Windows NT user account used to log on to the system.

    To debug a custom OLE Automation server
  1. Load your custom OLE Automation server project into Visual Basic.
  2. Set breakpoint(s) on the desired lines of source code.
  3. From the Run menu, choose Start With Full Compile.

    This registers and runs your custom OLE Automation server.

  4. Use the OLE Automation stored procedures to call the OLE objects exposed by your custom OLE Automation server.

    When a breakpoint is hit, the Visual Basic debugger is activated.

For more information, see your documentation for Visual Basic.

Note To use a custom OLE Automation server developed with 32-bit Visual Basic 4.0 with the OLE Automation stored procedures, Windows NT 3.51 or later Service Pack 4 must be installed on the SQL Server computer.

A custom in-process OLE server created using 32-bit Visual Basic 4.0 must have an error handler (specified with the On Error GoTo statement) for the Class_Initialize and Class_Terminate subroutines. The error handlers will prevent unhandled errors from occurring in the subroutines. Unhandled errors in the Class_Initialize and Class_Terminate subroutines can cause unpredictable SQL Server problems, such as a SQL Server access violation. Error handlers for other subroutines are also recommended.