Oracle® Objects for OLE C++ Class Library Developer's Guide 10g Release 1 (10.1) Part Number B10119-01 |
|
Applies To
Description
This method returns TRUE if the current record is valid.
Usage
oboolean IsValidRecord(void) const
Remarks
If the current record was deleted, or if the current record is before the first record or after the last record, then the current record is invalid and this method returns FALSE. A closed ODynaset also returns FALSE. Otherwise the current record is valid and this routine returns TRUE.
This method is more reliable for checking than IsLast when the fetch limit is a multiple of the total number of records in the table.
Return Value
TRUE if the current record is valid; FALSE otherwise.
Example
An example showing invalid record:
// open a database
ODatabase odb;
odb.Open("ExampleDB", "scott", "tiger");
// open a dynaset
ODynaset odyn;
odyn.Open(odb, "select * from emp");
// go to the first record
odyn.MoveFirst();
oboolean isvalid = odyn.IsValidRecord();
// isvalid is TRUE, unless the dynaset has no records
// go before first record
odyn.MovePrev();
isvalid = odyn.IsValidRecord();
// isvalid is FALSE now
// delete a record
odyn.MoveFirst();
odyn.MoveNext();
odyn.DeleteRecord();
isvalid = odyn.IsValidRecord();
// isvalid is FALSE now, because the current record is deleted