PRB: Source and Description Blank when Using Err.Raise from MTS and ASPID: Q238082 
  | 
When raising an error inside a Visual Basic component in a Microsoft Transaction Server (MTS) Server Package that is called from another Visual Basic component in a different MTS Server Package, ASP displays only the error number. The error source and description fields are empty.
Make sure that all the object references are set to Nothing before raising the error (particularly for the object that holds the reference to the ObjectContext.CreateInstance of the first component).
This behavior is by design.
Microsoft Transaction Server Type Library
Microsoft ActiveX Data Objects 2.x Library
Public Function RaiseError() As Variant
    Dim cmdADO As New ADODB.Command
    Dim objContext As ObjectContext
    Dim lErrNum As Long
    Dim sErrSrc As String
    Dim sErrDesc As String
    On Error GoTo Err_Handler
    Set objContext = GetObjectContext
    With cmdADO
        .ActiveConnection = "DSN=pubs;UID=sa;PWD="  'fill in your server credentials here!
        .CommandText = "Not a valid SQL statement"  'This will create an error
        .Execute
    End With
    objContext.SetComplete
    Set cmdADO = Nothing
    
    RaiseError = "No Error"
    Exit Function
Err_Handler:
    Set cmdADO = Nothing
    lErrNum = Err.Number
    sErrSrc = Err.Source
    sErrDesc = Err.Description
    objContext.SetAbort
    Set objContext = Nothing
    Err.Raise lErrNum, sErrSrc, sErrDesc
End Function Microsoft Transaction Server Type Library
Public Function CallRaiseError() As Variant
    Dim objRaiseError   As Object
    Dim objContext      As ObjectContext
    Dim lErrNum         As Long
    Dim sErrSrc         As String
    Dim sErrDesc        As String
    Set objContext = GetObjectContext
    On Error GoTo Err_Handler
    Set objRaiseError = objContext.CreateInstance("RaiseError.CRaiseError")
    objRaiseError.RaiseError
    objContext.SetComplete
    Set objRaiseError = Nothing
    CallRaiseError = "No Error"
    Exit Function
Err_Handler:
    lErrNum = Err.Number
    sErrSrc = Err.Source
    sErrDesc = Err.Description
    objContext.SetAbort
    'Set objRaiseError = Nothing 'if you leave this alive no err will be passed
    Set objContext = Nothing
    Err.Raise lErrNum, sErrSrc, sErrDesc
End Function 
<%
Option Explicit
On Error Resume Next
Dim objCallRaiseError
Set objCallRaiseError = Server.CreateObject("CallRaiseError.CCallRaiseError")
Response.Write "Executing Method on CallRaiseError which will execute method from RaiseError<br>"
objCallRaiseError.CallRaiseError
If Err.Number Then
	Response.write("Error Number : " & Err.Number & "<br>")
	Response.write("Error Source : " & Err.Source & "<br>")
	Response.write("Error Description : " & Err.Description & "<br>")
End IF
Set objCallRaiseError = Nothing 
%> Executing Method on CallRaiseError which will execute Method on RaiseErrorThe expected result was:
Error Number : -2147217900
Error Source :
Error Description :
Executing Method on CallRaiseError which will execute method from RaiseError
Error Number : -2147217900
Error Source : Microsoft OLE DB Provider for ODBC Drivers
Error Description : [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'Not'.
Additional query words:
Keywords          : kbADO kbADO100 kbADO150 kbADO200 kbADO201 kbADO210 kbASP kbCOMt kbMTS kbMTS100 kbVBp500 kbVBp600 kbNTOS400sp1 kbADO210sp2 
Version           : WINDOWS:1.0,1.5,2.0,2.01,2.1,2.1 SP1,2.1 SP2,5.0,6.0; winnt:1.0,2.0,4.0 SP4
Platform          : WINDOWS winnt 
Issue type        : kbprb 
Last Reviewed: August 3, 1999