This document is archived and information here might be outdated.  Recommended version.

IQueryName Interface (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Geodatabase > ESRI.ArcGIS.GeoDatabase > Interfaces > IQ > IQueryName Interface
ArcGIS Developer Help

IQueryName Interface

Provides access to the associated query definition. Note: the IQueryName interface has been superseded by IQueryName2. Please consider using the more recent version.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.


Name Description
Read/write property QueryDef QueryDef of feature class name.

Classes that implement IQueryName

Classes Description
FeatureQueryName Esri Feature Query Name object.
TableQueryName Esri Table Query Name object.

    public void IQueryName__(IWorkspace workspace)
        IFeatureWorkspace featureWorkspace = (IFeatureWorkspace)workspace;
        IQueryDef queryDef = featureWorkspace.CreateQueryDef();
        //examples of query def construction

        //Valid sub fields
        queryDef.SubFields = "Parcel.Area, Parcel.Parcel_ID";
        //Invalid sub fields
        //queryDef.SubFields = "max(Parcel.Area) as Max_Area";

        //Valid tables
        queryDef.Tables = "Parcels, Owners"; 
        //Invalid tables
        //queryDef.Tables = "Parcels p, Owners o";
        //queryDef.Tables = "Owners INNER JOIN parcels ON Owners.Parcel_id = parcels.Parcel_id";

        //Valid where clause
        queryDef.WhereClause = "Owner.Name like '%Smith%' and Owner.Address like '%Main Street%'";
        //Invalid where clause
        //queryDef.WhereClause = "Owner.Name like '%Smith%' group by Owner.City_Address";

        //set QueryDef property
        IQueryName queryName = new TableQueryNameClass();
        queryName.QueryDef = queryDef;