How to Determine What Relations Exist in a .DBC

Last reviewed: April 30, 1996
Article ID: Q129640
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, version 3.0

SUMMARY

The ADBOBJECT() function will create an array containing a a list of all persistent relations defined in a database container (.DBC file). This information can be useful outside of the database container. For example, it can be useful when you want to set relationships automatically for use within a one-to-many report.

MORE INFORMATION

The ADBOBJECT() function requires two parameters:

  • The first is the name of the array to be created.
  • The second indicates the type of information requested from the function.

For example, the following code creates an array called laRelations:

   OPEN DATABASE \vfp\samples\mainsamp\data\tastrade
   =ADBOBJECT(laRelations, "RELATION")
   DISPLAY MEMORY

The array contains five columns. Each relationship defined in the DBC will occupy one row in the array. The columns contain the following information:

   Column   Contents
   --------------------------------------------------------------
   1        Name of the parent table
   2        Name of the child table
   3        Name of the parent index tag involved in the relation
   4        Name of the child index tag involved in the relation
   5        Information for the Relational Integrity Builder

Column 5 contains up to three letters, indicating Update, Delete, and Insert triggers respectively. Each letter code within the column will contain a "C" for Cascade, an "R" for Restrict, or an "I" for Ignore. For example, a value of "CRR" in column 5 would indicate that updates should be cascaded, deletes should be restricted, and inserts should be restricted.

REFERENCES

The GENDBC utility uses this technique to define relationships as well as obtain other information from the DBC. If you would like to view the source code for this utility, it is stored as VFP\TOOLS\GENDBC\GENDBC.PRG.


Additional reference words: 3.00 VFoxWin
KBCategory: kbprg
KBSubcategory: FxprgTable


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 30, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.