How to debug a custom OLE Automation server (Transact-SQL)

How to Install SQL Server 2000

How To

How to debug a custom OLE Automation server (Transact-SQL)

You can debug a custom OLE Automation server created by using 32-bit Microsoft® Visual Basic® version 4.0. To do this, Visual Basic must be installed on the Microsoft SQL Server™ computer, and SQL Server must be running under the same Microsoft Windows NT® user account as Visual Basic. SQL Server must be started from the command prompt and independently 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. On the Run menu, click 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.

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.

See Also

System Stored Procedures

How to create an OLE Automation object (Transact-SQL)

Data Type Conversions Using OLE Automation Stored Procedures

OLE Automation Sample Script