virtual bool COSessionEx::AddConstraint(const CRefInfo &ThisInfo, const CRefInfo &RefInfo, LPOLESTR strKeyName, DBCONSTRAINTTYPE nConstraintType, DBUPDELRULE nUpdateRule=DBUPDELRULE_CASCADE, DBUPDELRULE nDeleteRule=DBUPDELRULE_CASCADE, DBMATCHTYPE nMatchType=DBMATCHTYPE_FULL);

Return Value

        true if successful; otherwise false.

Parameters

        [in] ThisInfo:

                A CRefInfo structure about columns of this table. For the details of CRefInfo, click here.

        [in] RefInfo:

                A CRefInfo structure about columns of a foreign/refered table. For the details of CRefInfo, click here.

        [in] strKeyName:

                A unicode string indicating a key name.

        [in] nConstraintType:

                One of these values: DBCONSTRAINTTYPE_UNIQUE, DBCONSTRAINTTYPE_FOREIGNKEY, DBCONSTRAINTTYPE_PRIMARYKEY, DBCONSTRAINTTYPE_CHECK.

        [in] nUpdateRule:

                One of these values: DBUPDELRULE_NOACTION, DBUPDELRULE_CASCADE, DBUPDELRULE_SETNULL, DBUPDELRULE_SETDEFAULT.

        [in] nDeleteRule:

                One of these values: DBUPDELRULE_NOACTION, DBUPDELRULE_CASCADE, DBUPDELRULE_SETNULL, DBUPDELRULE_SETDEFAULT.

        [in] nMatchType:

                One of these values: DBMATCHTYPE_NONE, DBMATCHTYPE_FULL, DBMATCHTYPE_PARTIAL. This field is ignored unless nConstraintType is DBCONSTRAINTTYPE_FOREIGNKEY.

Remark

        Adds a new constraint to a base table. For how to use it, see the example MkTblsEx.

COSessionEx Class Overview & Class Members