CdbField::CreateProperty Method

Creates a new user-defined Property object.

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 contains the name of the new property.
LONG lType Optional. The type of the new property. Its value may be one of those listed under Types in the core topic.
LPVARIANT pvValue Optional. A Variant variable containing the initial property value. See the Value property for details.
BOOL bDDL=FALSE Optional. A Boolean indicating whether or not the created Property object is a Data Definition Language object. If TRUE, the created Property object can't be changed or deleted unless the user has dbSecWriteDef permission. The default is FALSE.

Usage

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

CdbDBEngine      dben;
CdbDatabase      dbs;
CdbField         fld;
CdbProperty      prop;
COleVariant      vVal(FALSE, VT_BOOL);

// Initialization...
// Create a property that says whether this field is required.
fld = dbs.Fields[3L];         // Get the 4th field.
prop = fld.CreateProperty(_T("Required"), dbBoolean, &vVal, FALSE);
fld.Properties.Append( prop );