Link to home
Start Free TrialLog in
Avatar of eric07
eric07

asked on

Help with VB COM and ASP Type mismatch

I have the following VB COM Code:
Public Function Logon(enUseHow As USE_PROFILE_HOW) As ADODB.Recordset

    Dim oCommand As New ADODB.Command
    Dim oContext As ObjectContext
    Dim sStoredProc As String
   
On Error GoTo Err
    Set oContext = GetObjectContext

    Select Case enUseHow
        Case USE_COMPANY_ID
            sStoredProc = "CompanyLogon"
        Case USE_CLIENT_ID
        Case USE_WORK_ORDER_NUMBER
    End Select
   

    With oCommand
        .ActiveConnection = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Datalect Client Support;Data Source=EA_SYSTEM"
        .CommandType = adCmdStoredProc
        .CommandText = sStoredProc
        .Parameters.Refresh
        .Parameters("@CompanyID").Value = mvarID
        .Parameters("@Password").Value = mvarPassword
        Set Logon = .Execute
    End With
       
    Set oCommand = Nothing
   
    oContext.SetComplete
    Set oContext = Nothing
   
    Exit Function
   
Err:
   
    Set oCommand = Nothing
    oContext.SetAbort
    Set oContext = Nothing
   
End Function


A logon.htm file which calls the logon.asp page which has the following code:

<%@ LANGUAGE=VBSCRIPT TRANSACTION=Required %>

<%
      Dim sCoName
      Dim nSecID
      

      Dim Quote
      Quote = chr(34)
      
      Set oRec = Server.CreateObject( "ADODB.Recordset" )
      Set oLogon = Server.CreateObject( "Client_Support_COM.Logon" )
      
      oLogon.Password = Request.Form( "PWD" )
      oLogon.ID = Request.Form( "ID" )
      
      Set oRec = oLogon.Logon(USE_CLIENT_ID)
      oResults.Open()
      
      sCoName = oResults("CompanyName")      
      nSecID = oResults("SecurityID")
%>

<%      
      Sub OnTransactionCommit()
            Dim sURL
            
            sURL = "http://ea_system/Client_Support/app/main.asp?CoID="
            sURL = sURL & Request.Form( "ID" ) & "&CoName=" & sCoName & "&SecID=" & "1"
            Response.Redirect(sURL)
      End Sub
%>

<%
      Sub OnTransactionAbort()
            Response.Redirect( "http://ea_system/Client_Support/logon/logon.htm" )            
      End Sub
%>

<%
      Set oRec = Nothing
      Set oLogon = Nothing
      
%>

when I run it and enter the id and password then submit it fails where I set the oRec = oLogon code with the following error:

Microsoft VBScript runtime error '800a000d'

Type mismatch: 'oLogon.Logon'

/client_support/logon/logon.asp, line 17

Can anyone figure out why, Its driving me insane cause I'm returning a ADODB.Recordset and oRec is a ADODB.Recordset but I get the error.

Thanks

Avatar of eric07
eric07

ASKER

This is the full error:

Microsoft VBScript runtime error '800a000d'

Type mismatch: 'oLogon.Logon'

/client_support/logon/logon.asp, line 17

Response object error 'ASP 0156 : 80004005'

Header Error

/client_support/logon/logon.asp, line 36

The HTTP headers are already written to the client browser. Any HTTP header modifications must be made before writing page content.
ASKER CERTIFIED SOLUTION
Avatar of halapaya
halapaya

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
try using
<% response.buffer = True %>
at the top of the page
Avatar of eric07

ASKER

That solved my answer, thank you so much.