Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: DCOM nTier problem - Following ex in Pro VB6 DB (Williams)


Message #1 by "Kevin Riggs" <kevin.riggs@p...> on Fri, 28 Apr 2000 12:41:15
I'm trying to follow the example set in 
_Professional_Visual_Basic_6_Databases_ and I'm having some trouble with 
it.

On pages 331-339 I see examples of how to build a server component.  I have 
this item and it APPEARS to be getting records from a database using the 
following code:

Public Function listModels() As Object

    On Error GoTo BadList
    conn.ConnectionString = "DSN=laspas"
    Set listModels = conn.Execute("SELECT * FROM tblModels ORDER BY 
Model")
    Exit Function
                
BadList:
    Debug.Print Err.Number & Err.Description
    Set listModels = Err
    Err.Clear
   
End Function

I have declared conn as a Public ADODB.Connection globally


I then have a client application that SHOULD be returning said records into 
a client-side recordset (rs) that has been declared globally as an 
ADODB.Recordset (I also have a lighter weight ADOR.RecordSet called rrs).
The code is listed below:

Private Sub Form_Load()
    Set objModels = New SpaService.Models
    Fill_Models
End Sub


Private Sub Fill_Models()
    Set rs = New ADODB.Recordset
'**************************************************************
' The following line is the one that appears to cause trouble *
    Set rs = objModels.listModels                            '*
'**************************************************************
End Sub


objModels is declared in the (General) section of this form as 
SpaService.Models (ServerComponent.Class).  Am I just totally missing 
something here?  I have compiled my server component and it compiles with 
no problem.  When I switch to my Client app and try to run it, I get 
"Run-Time Error 13    Type MisMatch" when the form loads that contains the 
client code from above.  It always points to the highlighted line.

Thanks,

Kevin
kevin.riggs@p...

  Return to Index