CRecordset::IsBOF

如果将记录集定位,在第一条记录之前,返回非零。 没有当前记录。

BOOL IsBOF( ) const;

返回值

非零,如果记录集不包含记录,或者后滚,在第一条记录之前;否则为0。

备注

调用此成员函数,在从记录滚动到记录了解之前是否转到,在记录集的第一条记录之前。 可以使用 IsEOF 一起使用 IsBOF 确定记录集是否包含任何记录或为空。 在调用 Open后,因此,如果记录集不包含记录,IsBOF 返回非零。当您打开包含至少一个记录的记录集时,第一条记录为当前记录,并 IsBOF 返回0。

如果第一个记录为当前记录,并且您调用 MovePrevIsBOF 随后将返回非零。 如果 IsBOF 返回非零,并且您调用 MovePrev,错误。 如果 IsBOF 返回非零,当前记录未定义,因此,需要一个当前记录的所有事件导致错误。

示例

此示例使用 IsBOFIsEOF 检测记录集的限制为代码滚动在两个方向的记录集。

// Open a recordset; first record is current
CCustomer rsCustSet(&m_dbCust);
rsCustSet.Open();

if(rsCustSet.IsBOF())
   return;
   // The recordset is empty 

// Scroll to the end of the recordset, past 
// the last record, so no record is current 
while (!rsCustSet.IsEOF())
   rsCustSet.MoveNext();

// Move to the last record
rsCustSet.MoveLast();

// Scroll to beginning of the recordset, before 
// the first record, so no record is current 
while(!rsCustSet.IsBOF())
   rsCustSet.MovePrev();

// First record is current again
rsCustSet.MoveFirst();

要求

Header: afxdb.h

请参见

参考

CRecordset Class

层次结构图

CRecordset::IsEOF

CRecordset::MoveFirst

CRecordset::MovePrev