This document is archived and information here might be outdated.  Recommended version.


ICursor Interface (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference (GeoDatabase)  

ICursor Interface

Provides access to members that hand out enumerated rows, field collections and allows for the updating, deleting and inserting of rows.

Product Availability

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

Members

Description
Method DeleteRow Delete the existing Row in the database corresponding to the current position of the cursor.
Read-only property Fields The Fields Collection for this cursor.
Method FindField The index of the field with the specified name.
Method Flush Flush any outstanding buffered writes to the database.
Method InsertRow Insert a new Row into the database using the property values in the input buffer. The object ID of the new Row, if there is one, is returned.
Method NextRow Advance the position of the cursor by one and return the Row object at that position.
Method UpdateRow Update the existing Row in the database corresponding to the current position of the cursor.

CoClasses that implement ICursor

CoClasses and Classes Description
Cursor Esri Cursor object.
FeatureCursor Esri Feature Cursor object.
RelQueryCursor A cursor that is opened from a RelQueryTable.
TemporalCursor (esriTrackingAnalyst) Controls settings for the temporal cursor.

Remarks

Cursors are forward only; they do not support backing up and retrieving rows that have already been retrieved or making multiple passes over data. If an application needs to make multiple passes over the data, the application needs to reexecute the query that returned the cursor. If both executions of the query are made within the same edit session (or database transaction with the appropriate level of isolation), the application is guaranteed not to see any changes made to the data by other concurrently executing applications.

Note that while a cursor is created in the client's memory after a call to methods such as ITable.Search or ITable.Insert, the DBMS cursor is not created until a call to NextRow (or a similar method) is made. This is why retrieving the first row may take longer than subsequent rows, and because underlying DBMS errors might be raised on the call, error handling is recommended.

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.

.NET Snippets

Perform Attribute Query | Load Network Locations | Zoom to Selected Globe Features

.NET Samples

Export any network analysis class to a text file (Code Files: NAClassToTextfileCmd) | Closest facility solver (Code Files: frmClosestFacilitySolver) | ArcGIS Network Analyst extension Engine application (Code Files: frmLoadLocations) | 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) | Implementing extended criteria for some predefined schematic rules (Code Files: PlantWithoutEquipment) | Bind a geodatabase table to a .NET control (Code Files: TableWrapper) | Create camera flyby from path (Code Files: frmCameraPath) | Retrieve a color ramp from the SymbologyControl (Code Files: SymbolForm) | Migrating from VB6 to VB .NET for ArcGIS 10 (Code Files: ButtonAddIn clscopy_table_sel clsCopyTableSelection)

.NET Related Topics

Updating features | GeoData services | Geodatabase | GeoDatabaseUI | Geoprocessing services | How to create graph series with different color types | How to load data into a network analysis problem | How to work with geoprocessing services | How to zoom to selected features in globe | Joining data | Limiting query results and output | Migrating VB6 to VB.NET for ArcGIS 10 | Querying geodatabase tables | Sorting tables