CDaoRelationFieldInfo Structure

The CDaoRelationFieldInfo structure has the following form:

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

The CDaoRelationFieldInfo structure contains information about a field in a relation defined for data access objects (DAO). 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.

Members

m_strName

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

m_strForeignName

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

Comments

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.

For information on using this and other MFC DAO Info structures, see the article DAO Collections: Obtaining Information About DAO Objects in Visual C++ Programmer's Guide.

See Also   CDaoRelationInfo