I need to create a join between a shapefile and a table that have been added to the map, the issue seems to be with the

            memRelFact.Open("Table-Layer", (IObjectClass)fromTable, "TableFieldName" 
            + featureClass, "FeatureClassFieldName", "FeatureClassName", "TableName" 
            + esriRelCardinality.esriRelCardinalityOneToOne);   

I can't figure out how to fix the issue, the error message is 'no overload method for 'Open' takes 6 arguments' here is the entire class code:

    public void JoinTables()
        //Define the feature class
        IMxDocument mxDoc;
        IMap map;
        IFeatureLayer featureLayer;
        IFeatureClass featureClass;
        mxDoc = (IMxDocument)ArcMap.Application.Document;
        map = mxDoc.FocusMap;
        featureLayer = (IFeatureLayer)mxDoc.FocusMap.Layer[0];
        featureClass = featureLayer.FeatureClass;

        //Define the table to be joined
        IStandaloneTableCollection tabCollection;
        IStandaloneTable stTable;
        ITable fromTable;
        tabCollection = (IStandaloneTableCollection)map;
        stTable = tabCollection.StandaloneTable[0];//census
        fromTable = stTable.Table;

        //Join the table to the feature class
        IMemoryRelationshipClassFactory memRelFact;
        IRelationshipClass relClass;
        IDisplayRelationshipClass dispRC;
        // Create a memory relationship class
        // Cardinality is forward (origin to destination)
        // Options are: OneToOne, OneToMany, ManyToMany
        memRelFact = new MemoryRelationshipClassFactory();
        relClass = memRelFact.Open("Table-Layer", (IObjectClass)fromTable, "TableFieldName" 
            + featureClass, "FeatureClassFieldName", "FeatureClassName", "TableName" 
            + esriRelCardinality.esriRelCardinalityOneToOne);
        // Perform a join
        dispRC = (IDisplayRelationshipClass)featureLayer;
        dispRC.DisplayRelationshipClass(relClass, esriJoinType.esriLeftOuterJoin);
  • 'No overload method for Open takes 6 arguments' is the error message. I edited my question, thanks for the advice, I'm new to this – gisgirl Mar 25 '15 at 11:54

Check your arguments. There's not enough in your call.

Is that supposed to be a comma between "TableFieldName" and featureclass, and "TableName" and the cardinality?

That will give you 8 arguments.

 memRelFact.Open("Table-Layer", (IObjectClass)fromTable, "TableFieldName" 
        , featureClass, "FeatureClassFieldName", "FeatureClassName", "TableName" 
        , esriRelCardinality.esriRelCardinalityOneToOne);   

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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