DOC: Append Instructions for DAO TableDef Incorrect
ID: Q184511
|
The information in this article applies to:
-
The Microsoft Foundation Classes (MFC)
-
Microsoft Visual C++, 32-bit Editions, version 4.0
SUMMARY
In the "DAO TableDef: Using TableDefs" section appearing under
Visual C++ Books
MFC 4.0
Programming with MFC Encyclopedia
DAO TableDef
of the Visual C++ 4.0 documentation, the following set of instructions are
given on how to create a TableDef:
To create a tabledef.
- Construct a CDaoTableDef object, supplying a pointer to the
CDaoDatabase object to which the tabledef will belong.
- Call the tabledef object's Create member function.
- Set any of the tabledef object's properties that you want. Call the
SetAttributes, SetConnect, SetName, SetSourceTableName,
SetValidationRule, or SetValidationText member functions.
- Call the tabledef object's Append member function to save the
tabledef in the database's TableDefs collection. You can append
before or after creating fields, as described in the next step.
- Add fields to the tabledef by calling its CreateField member function
for each field. (You can not modify the schema of an attached table,
so this step applies only to local base tables and tables in external
data sources that you open directly.)
- Optionally add indexes to the tabledef by calling its CreateIndex
member function for each index.
The fourth step is out of sequence and contains incorrect information.
MORE INFORMATION
Step 4 above states that "You can append before or after creating fields,
as described in the next step." This is incorrect. Also, the TableDef's
Append member should be called after the procedures mentioned in steps 5
and 6.
The above instructions should read as follows:
To create a tabledef.
- Construct a CDaoTableDef object, supplying a pointer to the
CDaoDatabase object to which the tabledef will belong.
- Call the tabledef object's Create member function.
- Set any of the tabledef object's properties that you want. Call the
SetAttributes, SetConnect, SetName, SetSourceTableName,
SetValidationRule, or SetValidationText member functions.
- Add fields to the TableDef by calling its CreateField member function
for each field. (You can not modify the schema of an attached table,
so this step applies only to local base tables and tables in external
data sources that you can open directly).
- Optionally add indexes to the tabledef by calling its CreateIndex
member function for each index.
- Call the TableDef object's Append member function to save the
TableDef in the database's TableDefs collection.
NOTE: This documentation error is fixed in the Visual C++ 5.0
documentation.
Additional query words:
VC++
Keywords : kbdocfix kbdocerr
Version : WINNT:4.0
Platform : winnt
Issue type : kbhowto
|