MDAC 2.5 SDK - OLE DB Programmer's Reference
OLE DB Interfaces


 

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 and IRowsetChange::InsertRow require the use of an accessor. For more information about accessors, see "Accessors" in Chapter 6, "Getting and Setting Data."

IRowsetChange::SetData and IRowsetChange::InsertRow can fail for a number of 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 Properties" 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 "Changing Data" in Chapter 5, "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.