ICursor Interface

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

Members

Name 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.

ICursor.DeleteRow Method

Delete the existing Row in the database corresponding to the current position of the cursor.

Public Sub DeleteRow ( _
)
public void DeleteRow (
);

Remarks

The cursor must be initialized to a row (with the NextRow method) before this method can be successfully called.

This should only be called on update cursors. To delete a row retrieved from a search cursor, call IRow.Delete on the row itself.

ICursor.Fields Property

The Fields Collection for this cursor.

Public ReadOnly Property Fields As IFields
public IFields Fields {get;}

ICursor.FindField Method

The index of the field with the specified name.

Public Function FindField ( _
    ByVal Name As String _
) As Integer
public int FindField (
    string Name
);

Remarks

If the specified field cannot be found, this method returns a value of -1.

ICursor.Flush Method

Flush any outstanding buffered writes to the database.

Public Sub Flush ( _
)
public void Flush (
);

Remarks

This method should only be called on insert cursors.

ICursor.InsertRow Method

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.

Public Function InsertRow ( _
    ByVal buffer As IRowBuffer _
) As Object
public object InsertRow (
    IRowBuffer buffer
);

Remarks

This method should only be called on insert cursors.

ICursor.NextRow Method

Advance the position of the cursor by one and return the Row object at that position.

Public Function NextRow ( _
) As IRow
public IRow NextRow (
);

Remarks

The NextRow method on a search or update cursor returns the next row in the result set to the application. The row object returned is allocated and hydrated by the cursor, and a reference to it is handed to the application. To retrieve all rows in a result set containing N rows, the application must make N calls to NextRow. If no rows remain in the result set, this method returns a null value.

ICursor.UpdateRow Method

Update the existing Row in the database corresponding to the current position of the cursor.

Public Sub UpdateRow ( _
    ByVal Row As IRow _
)
public void UpdateRow (
    IRow Row
);

Remarks

This method should only be called on update cursors.

Classes that implement ICursor

Classes Description
Cursor Esri Cursor object.
FeatureCursor Esri Feature Cursor object.
RelQueryCursor A cursor that is opened from a RelQueryTable.

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.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.