I have three feature classes [CircuitSource(A),CircuitBreaker(B),Sub-Station(C)]. In the Geodatabase A and B has a 1:1 relationship based on a primary field namely 'FEEDERID'. C and B has a 1:many relationship based on a field namely 'STATIONID'. I have created a new feature in A(pFeatA) and related this feature to an existing feature(pFeatB) in B feature class so that the value of 'FEEDERID' in pFeatA gets populated in pFeatB. I used the following code.

IRelationshipClass relClass = null;

relClass.CreateRelationship(pFeatA as IObject, pFeatB as IObject);

But the value of 'FEEDERID' in pFeatA is getting populated in all features in B feature class which has 'FEEDERID' = null and the similar value of 'STATIONID' as that of pFeatB.

1 Answer 1


You are trying to create a relationship when you've mentioned that it already exists.

If you want to get related objects there are specific methods for it, like IRelationshipClass.GetObjectsRelatedToObject & IRelationshipClass.GetObjectsRelatedToObjectSet


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.