CDaoRecordset::IsEOF

BOOL IsEOF( ) const;
throw( CDaoException, CMemoryException );

Return Value

Nonzero if the recordset contains no records or if you have scrolled beyond the last record; otherwise 0.

Remarks

Call this member function as you scroll from record to record to learn whether you have gone beyond the last record of the recordset. You can also call IsEOF to determine whether the recordset contains any records or is empty. Immediately after you call Open, if the recordset contains no records, IsEOF returns nonzero. When you open a recordset that has at least one record, the first record is the current record and IsEOF returns 0.

If the last record is the current record when you call MoveNext, IsEOF will subsequently return nonzero. If IsEOF returns nonzero and you call MoveNext, an exception is thrown. If IsEOF returns nonzero, the current record is undefined, and any action that requires a current record will result in an exception.

Effect of specific methods on IsBOF and IsEOF settings:

This table shows which Move operations are allowed with different combinations of IsBOF/IsEOF.

MoveFirst, MoveLast MovePrev,

Move < 0

Move 0

MoveNext,

Move > 0

IsBOF=nonzero,
IsEOF=0
Allowed Exception Exception Allowed
IsBOF=0,
IsEOF=nonzero
Allowed Allowed Exception Exception
Both nonzero Exception Exception Exception Exception
Both 0 Allowed Allowed Allowed Allowed

Allowing a Move operation does not mean that the operation will successfully locate a record. It merely indicates that an attempt to perform the specified Move operation is allowed and will not generate an exception. The value of the IsBOF and IsEOF member functions may change as a result of the attempted Move.

The effect of Move operations that do not locate a record on the value of IsBOF and IsEOF settings is shown in the following table.

IsBOF IsEOF
MoveFirst, MoveLast Nonzero Nonzero
Move 0 No change No change
MovePrev, Move < 0 Nonzero No change
MoveNext, Move > 0 No change Nonzero

For more information about navigating in recordsets, see the article DAO Recordset: Recordset Navigation in Visual C++ Programmer's Guide. For related information, see the topic "BOF, EOF Properties" in DAO Help.

CDaoRecordset OverviewClass MembersHierarchy Chart

See Also   CDaoRecordset::IsBOF