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 .NET]
Public Function Search ( _
    ByVal QueryFilter As IQueryFilter, _
    ByVal Recycling As Boolean _
) As ICursor
[C#]
public ICursor Search (
    IQueryFilter QueryFilter,
    bool Recycling
);
[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.

When using cursors within an edit session, they should always be scoped to edit operations. In other words, a cursor should be created after an edit operation has begun and should not be used once that edit operation has been stopped or aborted.

See Also

ITable Interface

.NET Snippets

Perform Attribute Query

.NET Samples

Export any network analysis class to a text file (Code Files: NAClassToTextfileCmd) | Closest facility solver (Code Files: frmClosestFacilitySolver) | Service area solver (Code Files: frmServiceAreaSolver) | Location-allocation solver (Code Files: frmLocationAllocationSolver) | Vehicle routing problem solver (Code Files: frmVRPSolver) | Origin-destination cost matrix solver (Code Files: frmODCostMatrixSolver) | Bind a geodatabase table to a .NET control (Code Files: TableWrapper)

.NET Related Topics

GeoDatabaseUI | How to create graph series with different color types | How to load data into a network analysis problem