IRowPosition::SetRowPosition

OLE DB Programmer's Reference

Sets the current row position to a new hRow.

HRESULT SetRowPosition (    HCHAPTER          hChapter,    HROW              hRow,    DBPOSITIONFLAGS   dwPositionFlags);

Parameters

hChapter
[in]
The chapter associated with the current row, or with DB_NULL_HCHAPTER if the rowset is not chaptered.
hRow
[in]
The new current row.
dwPositionFlags
[in]
A flag indicating additional information about the new row position. One of values described in the following table.

Value Meaning
DBPOSITION_OK hRow specifies the current row position.
DBPOSITION_NOROW hRow is DB_NULL_ROW, and the current row position is undefined.
DBPOSITION_BOF hRow is DB_NULL_ROW, and the row position is before the beginning of the rowset.
DBPOSITION_EOF hRow is DB_NULL_ROW, and the row position is off the end of the rowset.

Return Code

S_OK
The method succeeded.
E_FAIL
A provider-specific error occurred.
DB_E_BADCHAPTER
hChapter was invalid.
DB_E_BADROWHANDLE
hRow was invalid.
DB_E_CANCELED
The operation was canceled by a client during notification. The current row is set to DB_NULL_ROW with a position flag indicating DBPOSITION_NOROW.
E_INVALIDARG
hRow was set to DB_NULL_ROW, and dwPositionFlags indicated DBPOSITION_OK.

dwPositionFlags indicated DBPOSITION_OK, but hRow was an invalid value.

dwPositionFlags indicated DBPOSITION_NOROW, DBPOSITION_BOF, or DBPOSITION_EOF, and hRow was not set to DB_NULL_ROW.

E_UNEXPECTED
IRowPosition::SetRowPosition was called without first calling IRowPosition::ClearRowPosition.

There is no current rowset.

ITransaction::Commit or ITransaction::Abort was called, and the object is in a zombie state.

Comments

IRowPosition::ClearRowPosition must be called prior to the first and any subsequent IRowPosition::SetRowPosition calls.

IRowPosition::SetRowPosition fires the following notification phases with either DBREASON_ROWPOSITION_CHANGED or DBREASON_ROWPOSITION_CHAPTERCHANGED:

  • DBEVENTPHASE_SYNCHAFTER
  • DBEVENTPHASE_DIDEVENT or DBEVENTPHASE_FAILEDTODO

The row position object maintains a reference count on the both the hRow and the hChapter by respectively calling IRowset::AddRefRows for the hRow and IChapteredRowset::AddRefChapter for the hChapter when IRowPosition::SetRowPosition is called.

1998-2001 Microsoft Corporation. All rights reserved.



Microsoft Ole Db 2.0 Programmer's Reference and Data Access SDK
Microsoft OLE DB 2.0 Programmers Reference and Data Access SDK (Microsoft Professional Editions)
ISBN: 0735605904
EAN: 2147483647
Year: 1998
Pages: 1083

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net