This document is archived and information here might be outdated. Recommended version. |
Provides access to the associated query definition. Note: the IQueryName interface has been superseded by IQueryName2. Please consider using the more recent version.
Name | Description | |
---|---|---|
QueryDef | QueryDef of feature class name. |
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;
}