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 need to query two feature class at the same time using IQueryFIlter.

For eg -

FeatureClass -- A has field OBJECTID

FeatureClass -- B has field OBJECTID

what i am tring to do is --

IQueryFilter iqf = new QueryFilter();
iqf .setWhereClause(B+".OBJECTID = "+A+".OBJECTID");
IFeatureCursor resultCursor =, false);  

Is this possible , if yes what is the correct methord because currently i am facing error--

"Too few parameters. Expected 1"

Might its not taking A.OBJECTID properly ////

share|improve this question
Did you read about joining tables in the online docs? – Kirk Kuykendall Jul 3 '13 at 13:05
IQueryFilter isn't really designed to join tables. For that you should be using a IQuerDef.… – travis Jul 3 '13 at 19:22
up vote 2 down vote accepted

It is difficult to do anything but the simplest queries in ArcObjects. Here is a method to create an in memory join between 2 tables.

public static ITable Join(string relationshipName, ITable tableA, ITable tableB, string tableAJoinField, string tableBJoinField, IQueryFilter queryF, string targetFields, esriJoinType joinType, esriRelCardinality cardinality)
            IMemoryRelationshipClassFactory mrcFactory = new MemoryRelationshipClassFactoryClass();
            IRelationshipClass relationship = mrcFactory.Open(
                (IObjectClass)tableA, tableAJoinField,
                (IObjectClass)tableB, tableBJoinField,
                "forward", "backward",

            // Open the RelQueryTable
            IRelQueryTableFactory rqtFactory = new RelQueryTableFactoryClass();

            bool joinForward = true;
            bool doNotPushJoinToDb = true;
            bool openAsLeftOuterJoin = (joinType == esriJoinType.esriLeftOuterJoin);

            IRelQueryTable relQueryTable = rqtFactory.Open(relationship, joinForward, queryF, null, targetFields, doNotPushJoinToDb, openAsLeftOuterJoin);
            ITable joinTable = relQueryTable as ITable;

            return joinTable;
share|improve this answer
Thanks it helped a lot .Just waiting for some more suggetions , if not will mark yours as answer.//// – NewBee Jul 3 '13 at 13:18

Your Answer


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

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