I already know how to do a table join with ArcObjects, via the IDisplayTable
, IMemoryRelationshipClassFactory
etc. interfaces. Here are some links to resources that have example code for this:
-
"Advanced" table join options in ArcObjects (ESRI ArcGIS Desktop discussion forums archive)
-
Export a join table to arcmap (question here on GIS Stack Exchange)
What I need to know is, how do I undo, i.e. remove such a join?
Once I've joined a standalone table to a feature layer, I end up with references to:
-
an
IRelationshipClass
(resulting from the join operation); -
an
ITable
/IStandaloneTable
/IDisplayTable
(the table that was joined to the feature layer); and -
an
IFeatureLayer
(the feature layer to which the table was joined).
Do these interfaces, or rather the objects behind them, allow unjoining at all? I've seen that IRelationshipClass
has various DeleteRelationship…
methods, but I can't see how they could work towards that end.
Best Answer
Code below works for me for a featurelayer. Similar logic could be used for a standalone table.
The documentation for IRelQueryTable at 10 seems to be missing this important graphic, that appears in 8.3 help doc: