CdbDatabase::CreateProperty Method

Creates a new user-defined Property object (Microsoft Jet workspaces only).

Syntax

CdbPropertyCreateProperty(LPCTSTR pstrName=NULL,

LONG lType=-1,

LPVARIANT pvValue=NULL,

BOOL bDDL=FALSE);

Parameters

Type Example Description
LPCTSTR pstrName Optional. A pointer to a string that uniquely names the new Property object. See the Name property for details on valid property names.
LONG lType Optional. A constant that defines the data type of the new Property object. See the Type property for valid data types.
LPVARIANT pvValue Optional. A pointer to a Variant containing the initial property value. See the Value property for details.
BOOL bDDL=FALSE Optional. A Boolean that indicates whether or not the Property is a DDL object. If TRUE, users can't change or delete this Property object unless they have dbSecWriteDef permission.

Usage

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

CdbDatabase      dbs;
CdbProperty      prop;
COleVariant      vVal(FALSE, VT_BOOL);
      
// Initialize dbs, etc.
// Create a property that says whether this database contains 
//   information that must be reported quarterly.

dbs  = dben.OpenDatabase(...);
prop = dbs.CreateProperty(_T("QuarterlyReportRequired"),                dbBoolean, &vVal, FALSE);
dbs.Properties.Append( prop );  // Append property.