Tuesday, 14 February 2017

DAO TableDefs

Ø A DAO Tabledef, represented in MFC by a CDaoTableDef object, is anobject that defines the structure of a base table or an attached table.
Ø A base table is a table in Microsoft Jet (.MDB) database. One can manipulate the structure of a base table using DAO objects DDL SQL statements.
Ø An attached table is a table in another database linked to a Microsoft Jet (.MDB) database.
Ø One can’t use Table-type record set with attached tables, but dynaset-type and snapshot-type recordsets with attached tables.
Ø USES: The main use of tabledef objects is to manipulate the structure of the table. Other functions include:
·        Base a recordset on a tabledef. The recordset is a table type recordset.
·        Examine structure of local base tables, attached tables, and external tables. The structure of a table includes its fields and indexes.
·        Add or delete fields and indexes in the local base tables and external tables.
·        Determine whether the data in the fields is editable.
·        Get or Set table’s validation conditions.
Ø Table can be used in two ways for opening recordset:
·        Open a recordset based on a CDaoTableDef pointer.
·        Create a table-type recordset based in the table.
Ø Each DAO database object maintains a TableDefs collection — a collection of all saved table definition in the database. Each tabledef object maintains two collections of its own:
·  Fields.  All the fields in the table definition- one for each field in the underlying table.
·  Indexes.  All the indexes defined for the table.


No comments:
Write comments