Returns the count of the features that meet the query filter selection criteria for the specified layer.
[Visual Basic 6.0] Function QueryFeatureCount(
ByVal MapName As String, _
ByVal LayerID As Long, _
ByVal Filter As IQueryFilter _
) As Long
[Visual Basic .NET] Public Function QueryFeatureCount ( _ ByVal MapName As String, _ ByVal LayerID As Integer, _ ByVal Filter As IQueryFilter _ ) As Integer
[C#] public int QueryFeatureCount ( string MapName, int LayerID, IQueryFilter Filter );
[Java] public int queryFeatureCount ( String MapName, int LayerID, IQueryFilter Filter ) throws IOException, AutomationException
[C++] HRESULT QueryFeatureCount( BSTR MapName, long LayerID, IQueryFilter* Filter, long* Count );
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
Count [out, retval]
Count is a parameter of type long
QueryFeatureCount returns the number of map features that match the parameters of a given query filter.
QueryFeatureCount 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 database’s help.
SearchShape
Geometry set in ISpatialFilter should meet the following criteria:Miscellaneous
MaxRecordCount does not affect QueryFeatureCount or QueryFeatureCount2.
There are two key differences between Find and QueryFeatureCount. 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.