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

eric07Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

eric07Author Commented:
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.
0
halapayaCommented:
First..
you have used VB enumeration types
enUseHow As USE_PROFILE_HOW , you might have define it as

Public ENum USE_PROFILE_HOW
 USE_COMPANY_ID
 USE_CLIENT_ID
 USE_WORK_ORDER_NUMBER
End Enum

And in ASP
Set oRec = oLogon.Logon(USE_CLIENT_ID)
you have pass the Parameter which is a Enum type.. thats where u have gone wrong.. do it this way.. when defining
your Enum type put it as

Public ENum USE_PROFILE_HOW
 USE_COMPANY_ID =0
 USE_CLIENT_ID =1
 USE_WORK_ORDER_NUMBER =2
End Enum

give ids..

then when u call it in ASP.. give the id insted of the whole word, so in this case it'll be

Set oRec = oLogon.Logon(1)

so in logon method

GetObjectContext

    Select Case enUseHow
        Case 0 :do this
        Case 1 :do this
        Case 2 :do this
    End Select

thats all.. it'll work then...

the other error which says headers have already been written to client.. check wether u have done any
response.write("blabla")
before redirecting to any page..
after u have written stuff using response.write() u can't redirect to another page..that usualy happense if u use response.write for debug purposes...

hope this helps
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JOKCommented:
try using
<% response.buffer = True %>
at the top of the page
0
eric07Author Commented:
That solved my answer, thank you so much.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.