Microsoft SDK for Java

getBOF

This method of the Recordset class indicates whether the current record position is before the first record in a Recordset object.

Syntax

public boolean getBOF();

Return Value

Returns True (-1) if the current record position is before the first record and False (0) if the current record position is on or after the first record.

Remarks

Use getBOF and getEOF to determine whether a Recordset object contains records or whether you've gone beyond the limits of a Recordset object when you move from record to record.

The getBOF method returns True (-1) if the current record position is before the first record; returns False (0) if the current record position is on or after the first record.

The getEOF method returns True if the current record position is after the last record; returns False if the current record position is on or before the last record.

If either getBOF or getEOF is True, there is no current record.

If you open a Recordset object containing no records, getBOF and getEOF are set to True and the Recordset object's record count is zero. When you open a Recordset object that contains at least one record, the first record is the current record and the getBOF and getEOF return values are False.

If you delete the last remaining record in the Recordset object, getBOF and getEOF may remain False until you attempt to reposition the current record.

This table shows which move methods are allowed with different combinations of getBOF and getEOF.

  moveFirst, moveLast movePrevious, move < 0 move 0 moveNext, move > 0
getBOF=True, getEOF=False Allowed Error Error Allowed
getBOF=False, getEOF=True Allowed Allowed Error Error
Both True Error Error Error Error
Both False Allowed Allowed Allowed Allowed

Allowing a move method doesn't guarantee that the method will successfully locate a record; it only means that calling the specified move method won't generate an error.

The following table shows what happens to the getBOF and getEOF settings when you call various move methods but are unable to successfully locate a record.

  getBOF getEOF
moveFirst, moveLast Set to True Set to True
move 0 No change No change
movePrevious, move < 0 Set to True No change
moveNext, move > 0 No change Set to True

© 1999 Microsoft Corporation. All rights reserved. Terms of use.