ArcObjects Library Reference  (GeoDatabase)    

ITable.Search Method

An object cursor that can be used to fetch row objects selected by the specified query.

[Visual Basic 6.0]
Function Search(
    ByVal QueryFilter As IQueryFilter, _
    ByVal Recycling As Boolean _
) As ICursor
[Visual Basic .NET]
Public Function Search ( _
    ByVal QueryFilter As IQueryFilter, _
    ByVal Recycling As Boolean _
) As ICursor
[C#]
public ICursor Search (
    IQueryFilter QueryFilter,
    bool Recycling
);
[Java]
public ICursor search (
    IQueryFilter QueryFilter,
    Boolean Recycling
)
throws
    IOException,
    AutomationException
[C++]
HRESULT Search(
  IQueryFilter* QueryFilter,
  VARIANT_BOOL Recycling,
  ICursor** Cursor
);
[C++]

Parameters

QueryFilter [in]

  QueryFilter is a parameter of type IQueryFilter

Recycling [in]

  Recycling is a parameter of type VARIANT_BOOL

Cursor [out, retval]

  Cursor is a parameter of type ICursor

Product Availability

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

Remarks

The Search method returns a search cursor that can be used to retrieve rows specified by a query filter. The recycling parameter controls row object allocation behavior. Recycling cursors rehydrate a single row object on each fetch and can be used to optimize read-only access, for example, when drawing. It is illegal to maintain a reference on a row object returned by a recycling cursor across multiple calls to NextRow on the cursor.

Row objects returned by a recycling cursor should not be modified. Non-recycling cursors return a separate row object on each fetch. The objects returned by a non-recycling cursor may be modified and stored with polymorphic behavior. The geodatabase guarantees ‘unique instance semantics’ on non-recycling row objects fetched during an edit session. If the row object to be retrieved by a call to search has already been instantiated and is being referenced by the calling application, then a reference to the existing row object is returned.

Non-recycling feature cursors returned from the Search method *MUST* be used when copying features from the cursor into an insert cursor of another class.  This is because a recycling cursor reuses the same geometry and under some circumstances all of the features inserted into the insert cursor may have the same geometry.  Using a non-recycling cursor ensures that each geometry is unique.

See Also

ITable Interface