Clone Method

See Also    Example    Applies To

Creates a duplicate CdbRecordset object that refers to the original CdbRecordset object.

Syntax

CdbRecordsetClone(VOID);

Remarks

Clone returns an instance of CdbRecordset.

Remarks

Use the Clone method to create multiple, duplicate CdbRecordset objects. Each CdbRecordset can have its own current record. Using Clone by itself doesn't change the data in the objects or in their underlying structures. When you use the Clone method, you can share bookmarks between two or more CdbRecordset objects because their bookmarks are interchangeable.

You can use the Clone method when you want to perform an operation on a CdbRecordset that requires multiple current records. This is faster and more efficient than opening a second CdbRecordset. When you create a CdbRecordset with the Clone method, it initially lacks a current record. To make a record current before you use the CdbRecordset clone, you must set the Bookmark property or use one of the Move methods, one of the Find methods, or the Seek method.

Using the Close method on either the original or duplicate object doesn't affect the other object. For example, using Close on the original CdbRecordset doesn't close the clone.

Notes

Usage

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

CdbRecordset      rstOriginal, rstNew;
...   // Open the original recordset.
      // Make a duplicate of it.
rstNew = rstOriginal.Clone();