CdbDatabase::Synchronize Method

Synchronizes two replicas (Microsoft Jet databases only).

Syntax

VOIDSynchronize(LPCTSTR pstrReplica,

LONG lType=-1);

Parameters

Type Example Description
LPCTSTR pstrReplica A pointer to a string that contains the path to the target replica with which this database will be synchronized. The .mdb file name extension is optional.
LONG lType Optional. A constant indicating which direction to synchronize changes between the two databases, as specified in Settings.

Settings

You can use the following constants in the second argument. You can use one of the first three constants with or without the fourth constant.

Constant Description
dbRepExportChanges Sends changes from database object to pstrReplica.
dbRepImportChanges Sends changes from pstrReplica to database object.
dbRepImpExpChanges (Default) Sends changes from database object to pstrReplica, and vice-versa, also known as bi-directional exchange.
dbRepSyncInternet Exchanges data between files connected by an Internet pathway.

Usage

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

CdbDBEngin   dben;
CdbDatabase   db;
...                        // Initialize db, etc.
db = dben.OpenDatabase(_T("OutOfDateReplica.mdb"));
db.Synchronize(_T("file:\\website\UpToDateReplica.mdb"),
                  (dbRepImpExpChanges|dbRepSyncInternet));