CDaoRecordset::Requery

virtual void Requery( );
throw( CDaoException, CMemoryException );

Remarks

Call this member function to rebuild (refresh) a recordset. If any records are returned, the first record becomes the current record.

In order for the recordset to reflect the additions and deletions that you or other users are making to the data source, you must rebuild the recordset by calling Requery. If the recordset is a dynaset, it automatically reflects updates that you or other users make to its existing records (but not additions). If the recordset is a snapshot, you must call Requery to reflect edits by other users as well as additions and deletions.

For either a dynaset or a snapshot, call Requery any time you want to rebuild the recordset using parameter values. Set the new filter or sort by setting m_strFilter and m_strSort before calling Requery. Set new parameters by assigning new values to parameter data members before calling Requery.

If the attempt to rebuild the recordset fails, the recordset is closed. Before you call Requery, you can determine whether the recordset can be requeried by calling the CanRestart member function. CanRestart does not guarantee that Requery will succeed.

Caution   Call Requery only after you have called Open.

You can’t call Requery on a dynaset-type or snapshot-type recordset if calling CanRestart returns 0, nor can you use it on a table-type recordset.

If both IsBOF and IsEOF return nonzero after you call Requery, the query didn’t return any records and the recordset will contain no data.

For more information about updating data, see the article DAO Recordset: Recordset Operations in Visual C++ Programmer's Guide. For related information, see the topic "Requery Method" in DAO Help.

CDaoRecordset OverviewClass MembersHierarchy Chart

See Also   CDaoRecordset::CanRestart