Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?


share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.