Oracle® Objects for OLE C++ Class Library Developer's Guide 10g Release 2 (10.2) Part Number B14308-01 |
|
Applies To
Description
This method changes the current record to be the previous record in the dynaset's result set.
Usage
oresult OBinder::MovePrev(void)
oresult ODynaset::MovePrev(oboolean gopast = TRUE)
Arguments
gopast |
TRUE when we allow the current record mark to go before the first record in the set |
This method sets the current record of the dynaset (for OBinder, the dynaset being managed by the OBinder object) to be the previous record in the result set.
It is possible to MovePrev before the first record in the dynaset. The current record then becomes invalid and the IsBOF method returns TRUE. This is the default behavior. If you want to restrict dynaset navigation to valid records, pass in a gopast argument of FALSE. OBinder::MovePrev always restricts navigation to valid records.
Execution of this method sends OADVISE_MOVE_PREV messages to all attached advisories. One of the advisories could cancel the move, which would result in an OFAILURE return.
If the dynaset is being managed by an OBinder object, this method causes PreMove and PostMove triggers to be called.
Return Value
An oresult indicating whether the operation succeeded (OSUCCESS) or not (OFAILURE).
Example
This example traverses a dynaset record set from the last record to the first.
// open a database
ODatabase odb("ExampleDB", "scott", "tiger");
// construct and open the ODynaset
ODynaset odyn(odb, "select * from emp order by empno");
// go to the end
odyn.MoveLast();
// and go through all the records
while (!odyn.IsBOF())
{
// process the record
// go to the previous record
odyn.MovePrev();
}