Provides access to members that return information about the row, the table the row belongs to and storing and deleting the row.
Product Availability
Description
An instance of the Row object 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 using its Object ID (for example, ITable::GetRow).
Once retrieved, clients may query the row object for additional interfaces and invoke methods on the row object. The CLSID property of a Table determines the type of row object returned by the Table.
A new persistent row object is created using the ITable::CreateRow method. The act of creating a row assigns it identity.
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 a table's fields collection is the same as the numeric index of the field in the row's fields collection. This means that application programs can and should cache field numeric indexes using the FindField method on table, rather than invoking the FindField method for each row returned by a Cursor.
Members
Description | ||
---|---|---|
Delete | Deletes the row. | |
Fields | The fields Collection for this row buffer. | |
HasOID | Indicates if the row has an OID. | |
OID | The OID for the row. | |
Store | Stores the row. | |
Table | The Table for the row. | |
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 object. |
ComplexEdgeFeature | Esri Complex edge geometric network feature object. |
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 a feature or a row. |
NALocationObject (esriNetworkAnalyst) | A network location which can be used like a row. |
NALocationRangesFeature (esriNetworkAnalyst) | A container of NALocationRanges which can be used like a feature or a row. |
NALocationRangesObject (esriNetworkAnalyst) | A container of NALocationRanges which can be used like a row. |
Object | Esri Object object. |
RelQueryRow | A row defined by a join of the datasets in a RelQueryTable. |
Row | Esri Row object. |
SchematicDiagram (esriSchematic) | A schematic diagram object. |
SchematicInMemoryFeatureLink (esriSchematic) | Schematic in memory feature link object. |
SchematicInMemoryFeatureNode (esriSchematic) | Schematic in memory feature node object. |
SchematicInMemoryFeatureNodeOnLink (esriSchematic) | Schematic in memory feature node on link object. |
SchematicInMemoryFeatureSubLink (esriSchematic) | Schematic in memory feature sublink object. |
SchematicLink (esriSchematic) | A schematic link object. |
SchematicNode (esriSchematic) | A schematic node object. |
SchematicNodeOnLink (esriSchematic) | A schematic node-on-link object. |
SchematicSubLink (esriSchematic) | A schematic sublink object. |
SimpleEdgeFeature | Esri Geometric network simple edge feature object. |
SimpleJunctionFeature | Esri Geometric network simple junction feature object. |
TemporalFeature (esriTrackingAnalyst) | Controls properties of the Temporal Feature object. |
TopologyErrorFeature | Esri Topology Error Feature object. |
Remarks
The IRow interface inherits from the IRowBuffer interface and includes properties and methods to get and set the row's values, detect whether the row has an Object ID (and retrieve it, if it does has one), get the row's table, delete the row, and persist any changes made to 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 Object ID 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.
- 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.
- 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.
- 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.
- 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.
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();
}
See Also
ITable Interface | IRowBuffer Interface