CDaoRelationFieldInfo Structure


The new home for Visual Studio documentation is Visual Studio 2017 Documentation on

The latest version of this topic can be found at CDaoRelationFieldInfo Structure.

The CDaoRelationFieldInfo structure contains information about a field in a relation defined for data access objects (DAO).

struct CDaoRelationFieldInfo  
    CString m_strName;           // Primary  
    CString m_strForeignName;    // Primary  


The name of the field in the primary table of the relation.

The name of the field in the foreign table of the relation.

A DAO relation object specifies the fields in a primary table and the fields in a foreign table that define the relation. The references to Primary in the structure definition above indicate how the information is returned in the m_pFieldInfos member of a CDaoRelationInfo object obtained by calling the GetRelationInfo member function of class CDaoDatabase.

Relation objects and relation field objects are not represented by an MFC class. Instead, the DAO objects underlying MFC objects of class CDaoDatabase contain a collection of relation objects, called the Relations collection. Each relation object, in turn, contains a collection of relation field objects. Each relation field object correlates a field in the primary table with a field in the foreign table. Taken together, the relation field objects define a group of fields in each table, which together define the relation. CDaoDatabase lets you access relation objects with a CDaoRelationInfo object by calling the GetRelationInfo member function. The CDaoRelationInfo object, then, has a data member, m_pFieldInfos, that points to an array of CDaoRelationFieldInfo objects.

Call the GetRelationInfo member function of the containing CDaoDatabase object in whose Relations collection is stored the relation object you are interested in. Then access the m_pFieldInfos member of the CDaoRelationInfo object. CDaoRelationFieldInfo also defines a Dump member function in debug builds. You can use Dump to dump the contents of a CDaoRelationFieldInfo object.

Header: afxdao.h

Structures, Styles, Callbacks, and Message Maps
CDaoRelationInfo Structure