CdbDatabase::CreateRelation Method

Creates a new Relation object (Microsoft Jet workspaces only).

Syntax

CdbRelationCreateRelation(LPCTSTR pstrName=NULL,

LPCTSTR pstrTable=NULL,

LPCTSTR pstrForiegn=NULL,

LONG lAttributes=-1);

Parameters

Type Example Description
LPCTSTR pstrName Optional. A pointer to a string that uniquely names the new Relation object. See the Name property for details on valid relation names.
LPCTSTR pstrTable Optional. A pointer to a string that names the primary table in the relation. If the table doesn't exist before you append the Relation object, a run-time error occurs.
LPCTSTR pstrForiegn Optional. A pointer to a string that names the foreign table in the relation. If the table doesn't exist before you append the Relation object, a run-time error occurs.
LONG lAttributes Optional. A constant or combination of constants that contains information about the relationship type. See the Attributes property for details.

Usage

#include <afxole.h>
#include <dbdao.h>
...
CdbDBEngine   dben;
CdbDatabase   dbs;
CdbRelation   rel;

dbs = dben.OpenDatabase(_T("Acme.mdb"));
rel = dbs.CreateRelation(_T("EmpSecurity"),_T("Employees"),
                         _T("SocialSecurity", dbRelationUnique);