I create a RelQueryTable like this to join a GeoFeatureLayer to an external table. Everything seems to work (no errors, I can look in the table and see the correct fields.) Silly question: what do I return from this that I can use as a GeoFeatureLayer? When I try to cast the table to GeoFeatureLayer it will not work. It was hard enough to riddle out how this even worked (and I still have many unanswered questions that the bathtub documentation doesn't help with while I'm adrift at sea.)
Does anyone have intelligent samples for these APIs? (Instead of changing 9.x to 10.x they should have released some code.)
Type memoryRelationshipClassFactory = Type.GetTypeFromProgID
( "esriGeodatabase.MemoryRelationshipClassFactory" );
IMemoryRelationshipClassFactory memoryRelationshipFactory =
Activator.CreateInstance( memoryRelationshipClassFactory ) as
IMemoryRelationshipClassFactory;
IRelationshipClass relationshipClass = memoryRelationshipFactory.Open(
"Join",
geoFeatureLayer.DisplayFeatureClass as IObjectClass,
layerField,
table as IObjectClass,
tableField,
"forward",
"backward",
esriRelCardinality.esriRelCardinalityOneToOne );
Type rqtFactoryType = Type.GetTypeFromProgID( "esriGeodatabase.RelQueryTableFactory" );
IRelQueryTableFactory rqtFactory = Activator.CreateInstance( rqtFactoryType ) as
IRelQueryTableFactory;
IRelQueryTable relQueryTable = rqtFactory.Open(
relationshipClass,
true,
null,
null,
EXTERNAL_FIELDS,
true,
false ) as IRelQueryTable;