Udostępnij za pośrednictwem


IRowsetChange

The methods in IRowsetChange are used to update the values of columns in existing rows, delete existing rows, and insert new rows.

IRowsetChange requires IAccessor and IRowset.

When to Implement

Rowsets implement IRowsetChange if they support updating, deleting, or inserting rows. They are not required to support all three but must support at least one of these operations to support IRowsetChange. The rowset reports which operations it supports through the DBPROP_UPDATABILITY property.

To request updatability of the rowset, the consumer should set DBPROP_IRowsetChange to VARIANT_TRUE and specify the desired updatability in the DBPROP_UPDATABILITY rowset property when creating the rowset.

When to Call

The consumer calls methods in IRowsetChange to modify rows as follows.

  • IRowsetChange::SetData sets column data in an existing row.

  • IRowsetChange::DeleteRows deletes existing rows.

  • IRowsetChange::InsertRow creates a new row and sets initial values.

IRowsetChange::SetData and IRowsetChange::InsertRow require the use of an accessor. For more information about accessors, see the section about Accessors in Getting and Setting Data.

IRowsetChange::SetData and IRowsetChange::InsertRow can fail for several reasons. The most common of these is that new data values do not meet the schema or integrity constraints of the column. Furthermore, rowsets can have row-by-row and column-by-column access permissions that override the general permissions of the table or column. For more information, see the DBPROP_COLUMNRESTRICT and DBPROP_ROWRESTRICT properties Rowset Property Group in Appendix C.

If IRowsetUpdate is exposed on the rowset, changes made through IRowsetChange are buffered in the rowset and not transmitted to the data store until IRowsetUpdate::Update is called; this is known as delayed update mode. If IRowsetUpdate is not exposed on the rowset, changes made through IRowsetChange are immediately transmitted to the data store; this is known as immediate update mode. For more information, see the section on Changing Data in Updating Data in Rowsets.

Method

Description

DeleteRows

Deletes rows.

InsertRow

Creates and initializes a new row.

SetData

Sets data in one or more columns in a row.

This topic is a part of: