CdbRecordset::FillCache Method

Fills all or a part of a local cache for a Recordset object that contains data from a Microsoft Jet-connected ODBC data source (Microsoft Jet-connected ODBC databases only).

Syntax

VOIDFillCache(LONG lRows=-1, CdbBookmark *pbm=NULL);

Parameters

Type Example Description
LONG lRows Optional. An integer that specifies the number of rows to store in the cache. If you omit this argument, the value is determined by the CacheSize property setting.
CdbBookmark * pbm=NULL Optional. Pointer to a bookmark. The cache is filled starting from the record indicated by this bookmark. If you omit this argument, the cache is filled starting from the record indicated by the CacheStart property.

Usage

#include <afxole.h>
#include <dbdao.h>

CdbDBE   ngine      dben(..., dbUseODBC);
CdbDatabase      dbs;
CdbRecordset      rst;
CdbBookmark      book;

dbs = dben.OpenDatabase(_T("ODBC;..."));
rst = dbs.OpenRecordset(..., dbOpenDynaset);
if (rst.Bookmarkable())
{
   // Remember the current record position.
book = rst.GetBookmark();
   // Start the cache from the current position.
rst.SetCacheStart(book);
   // The cache will hold 25 records.
rst.SetCacheSize(25);
rst.FillCache();
   // Do some work...
rst.MoveNext();
   // Get a few more records.
book = rst.GetBookmark();
rst.FillCache(5, &book);
...
}