ArcObjects Library Reference  (GeoDatabase)    

IRow Interface

Provides access to members that return information about the row, the table the row belongs to and storing and deleting the row.

Product Availability

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

Description

A Row object is an instantiated software object that represents a persistent row in a Table. A row object is normally obtained from a cursor on a table (for example, ICursor::NextRow) or fetched directly, given its Object ID (for example, ITable::GetRow).

Once retrieved, clients may query the row object for addtional interfaces and invoke methods on the row object. The CLSID property of a Table determines the type of row object by the Table.

A new persistent row object is created using the ITable::CreateRow method.  The act of creating a row assigns it identity. Note that applications should use the CreateRow method to create new persistent row objects, as opposed to directly cocreating the row objects. The latter will not create a row in the underlying persistent store.

A Row has a set of Fields. The set of Fields for a Row is the same as the set of Fields for its Table. In particular, the numeric index of a field in the Fields collection of its table is the same as the numeric index of the field in the Fields collection of the row, which is the same as the numeric index used to access the valie of the field from the row. This means that application programs can and should cache field numeric indexes using the FindField method on Table object, rather than invoking the FindField method once per row returned by a Cursor.

Members

Description
Method Delete Deletes the row.
Read-only property Fields The fields Collection for this row buffer.
Read-only property HasOID Indicates if the row has an OID.
Read-only property OID The OID for the row.
Method Store Stores the row.
Read-only property Table The Table for the row.
Read/write property Value The value of the field with the specified index.

Inherited Interfaces

Interfaces Description
IRowBuffer Provides access to members used for getting and modifying a rows values and for getting the fields in the row.

CoClasses that implement IRow

CoClasses and Classes Description
AnnotationFeature (esriCarto) An ESRI annotation feature.
AttributedRelationship ESRI Attributed Relationship.
ComplexEdgeFeature ESRI Complex edge geometric network feature.
ComplexJunctionFeature ESRI Complex junction geometric network feature.
CoverageAnnotationFeature ESRI Coverage Annotation Feature.
DimensionFeature (esriCarto) ESRI Dimension Feature class.
Feature ESRI Feature.
GeocodedFeature (esriLocation) A feature created by a locator.
NALocationFeature (esriNetworkAnalyst) A network location which can be used like feature a row.
NALocationObject (esriNetworkAnalyst) A network location which can be used like a row.
Object ESRI Object.
RelQueryRow A row defined by a join of the datasets in a RelQueryTable.
Row ESRI Row.
SchematicDiagram (esriSchematic) Schematic diagram object.
SchematicDrawing (esriSchematic) Schematic drawing object.
SchematicLink (esriSchematic) Schematic link object.
SchematicNode (esriSchematic) Schematic node object.
SchematicNodeOnLink (esriSchematic) Schematic node-on-link object.
SchematicSubLink (esriSchematic) Schematic sublink object.
SimpleEdgeFeature ESRI Geometric network edge feature.
SimpleJunctionFeature ESRI Geometric network simple junction feature.
TemporalFeature (esriTrackingAnalyst) Controls properties of the Temporal Feature object.
TopologyErrorFeature ESRI Topology Error Feature.

Remarks

The IRow interface inherits from IRowBuffer and includes methods to get and set the values for the Fields in the Row, given the numeric index of the Field for the Row, which is the same as the numeric index of the Field in the Table for the Row.

The OID property returns the unique object identifier for the Row that distinguishes it from other rows in the Table. If the HasOID property returns false, then this row was returned from a Table lacking a geodatabase-managed OID Field.  This generally occurs when the table is not registered with the geodatabase, see the IClassSchemaEdit::RegisterAsObjectClass method for more information.

The Store method is called by an application once it has modified the values of a Row. Calling the Store method triggers the following actions.

  1. The IRowEvents::OnChanged method is called for the Row being stored (the OnNew method is called if this is a newly created row being stored for the first time). A custom row object can implement the RowEvents::OnChanged method and take some special action when it is called—for example, update a special column in the row.
  2. The IRelatedObjectEvents::RelatedObjectChanged method is called for related objects in related object class if the table for this row is an object class that participates in relationship classes with notification.

Once Store is called on a Row object, all subsequent queries against the Table within the same edit session using the geodatabase API will reflect the modified state of the row object.

The Delete method is called by an application to delete a row object from the database. Calling the Delete method triggers the following actions.

  1. The IRowEvents::OnDelete method is called for the Row being deleted. A custom row object can implement the IRowEvents::OnDelete method and take some special action when it is called.
  2. All relationships in which the row object participates are automatically deleted.

Once Delete is called on a Row object, all subsequent queries against the Table within the same edit session using the geodatabase API will reflect the deleted state of the row object.

The changes made to a row object using the Store and Delete methods will be committed to persistent store if the containing edit session is saved and no conflicts are detected. If the changes were made outside of an edit session, then the application program is responsible for directly managing underlying database transactions using the ITransactions interface on the Workspace.

[C#]

This example shows the creation of a row, then an update, followed by it being deleted.

    //e.g., nameOfField = "FruitName";
    public void IRow__(ITable table, string nameOfField)
    {
        int fieldIndex = table.FindField(nameOfField);
        //insert row
        IRow row = table.CreateRow();
        //initalize all of the default field values for the new row.
        IRowSubtypes rowSubTypes = (IRowSubtypes)row;
        rowSubTypes.InitDefaultValues();
        row.set_Value(fieldIndex, "Banana");
        row.Store();
        //update row
        row.set_Value(fieldIndex, "Ripe Banana");
        row.Store();
        //delete row
        row.Delete();
    }

[Visual Basic 6.0]

This example shows the creation of a row, then an update, followed by it being deleted.

Dim pRow As IRow
Dim i As Long
i = pTable.FindField(“FruitName”)
‘ Insert Row
Set pRow = pTable.CreateRow
pRow.Value(i) = “Banana”
pRow.Store
‘ Update Row
pRow.Value(i) = “Ripe Banana”
pRow.Store
‘ Delete Row
pRow.Delete

See Also

ITable Interface | IRowBuffer Interface

 


Feedback Send feedback on this page