ArcObjects Library Reference (Carto)  

IMapServer2.QueryFeatureIDs Method

Returns the IDs of the features that meet the query filter selection criteria for the specified layer.

[Visual Basic .NET]
Public Function QueryFeatureIDs ( _
    ByVal MapName As String, _
    ByVal LayerID As Integer, _
    ByVal Filter As IQueryFilter _
) As IFIDSet
[C#]
public IFIDSet QueryFeatureIDs (
    string MapName,
    int LayerID,
    IQueryFilter Filter
);
[C++]
HRESULT QueryFeatureIDs(
  BSTR MapName,
  long LayerID,
  IQueryFilter* Filter,
  IFIDSet** FIDs
);
[C++]

Parameters

MapName [in]   MapName is a parameter of type BSTR LayerID [in]   LayerID is a parameter of type long Filter [in]

  Filter is a parameter of type IQueryFilter

FIDs [out, retval]

  FIDs is a parameter of type IFIDSet

Product Availability

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

Remarks

QueryFeatureIDs returns the IDs (FIDSet) of map features that match the parameters of a given query filter.

QueryFeatureIDs requires a number of input parameters. These include: a MapName, LayerID, and a QueryFilter. The QueryFilter can be an attribute query (SQL espression), a spatial query, or a combination of both.

QueryFilter 

QueryFilter provides the ability to query based on attribute filter (SQL expression) a spatial filter, or a combination of both. Attribute filters take any valid non-GIS data specific SQL statement. For example, CNTRY_CODE = BD or POPULATION = 12345. Syntax for querying date fields depend on the underlying data. If you are working with Shapefile or File GeoDatabase data the syntax is <FieldName> = date YYYY-MM-DD; for Access-based Personal GeoDatabase the sytax is #YYYY-MM-DD#. For SDE database, check with the specific databases help.

SearchShape 

Geometry set in ISpatialFilter should meet the following criteria:

Miscellaneous

MaxRecordCount does not affect QueryFeatureIDs or QueryFeatureIDs2.

There are two key differences between Find and QueryFeatureIDs. The first is that Find can work on multiple layers while the query methods work with a single layer. The second is that Find only works with a search string. The query methods use a queryFilter as a parameter. This allows the query to be based on either an attribute filter (SQL expression) or a spatial filter.

The results of this function can be used with LayerDescription::SelectionFeatures to display the selection in the exported image.

See Also

IMapServer2 Interface