I have a in memory table that gets created, and want to join it to a table from SDE. I have tried the following code.
Private Sub JoinTables(sdetable As ITable, inMemoryTable As ITable, joinField As String)
++ Create the MemoryRelationshipClass that defines what is to be joined
Dim pMemRelClassFact As IMemoryRelationshipClassFactory
Set pMemRelClassFact = New MemoryRelationshipClassFactory
Dim pRelClass As IRelationshipClass
Set pRelClass = pMemRelClassFact.Open("test", sdetable, "ID_NUMBER", inMemoryTable, "ID_NUMBER", "forward", "backward", esriRelCardinalityOneToMany)
' ++ Perform the join
Dim pRelQueryTableFact As IRelQueryTableFactory
Dim pRelQueryTab As ITable
Set pRelQueryTableFact = New RelQueryTableFactory
Set pRelQueryTab = pRelQueryTableFact.Open(pRelClass, True, Nothing, Nothing, "", True, True)
' ++ Print the fields Dim pCursor As ICursor Set pCursor = pRelQueryTab.Search(Nothing, True)
Dim pField As IField
Dim pFields As IFields
Dim intI As Integer, intJ As Integer
Set pFields = pCursor.Fields
intI = pFields.FieldCount - 1
For intJ = 0 To intI
Set pField = pFields.Field(intJ)
Debug.Print pField.Name Next intJ
End Sub
but i get a type mismatch error on the line
Set pRelClass = pMemRelClassFact.Open("test", sdetable, "ID_NUMBER", inMemoryTable, "ID_NUMBER", "forward", "backward", esriRelCardinalityOneToMany)
Is it not possible to join a in memory table to an sde table, or is there a better way of doing this?
Thanks
