ArcObjects Library Reference (GeoDatabase)  

IQueryName Interface

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

Product Availability

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

Members

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

CoClasses that implement IQueryName

CoClasses and Classes Description
FeatureQueryName Esri Feature Query Name object.
TableQueryName Esri Table Query Name object.
[C#]

    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;
    }