Tuesday, 14 February 2017

DAO RECORDSET

Ø A DAO recordset, represented in MFC by a object, represents the records in a base table or the records that result from running a query. Here we can usedCDaoRecordset class.
Ø A recordset represents, simultaneously:
·  All of the records in a table or query — a set of records.
·  The current record in that set, whose fields fill the recordset's field data members, if any.
Ø DAO Record Set Types:
You can create three kinds of objects:
Table-type recordsets, representing a base table in a Microsoft Jet (.MDB) database. A table-type recordset is based directly on the table rather than on a query.
Dynaset-type recordsets, which result from a query. A dynaset is a recordset that reflects changes to the underlying records by other users of the database or by other recordsets. As your application scrolls to a changed record, a new copy is retrieved, bringing it up to date. This behavior is ideal for situations in which it is important to be completely up to date.
Note   A dynaset is a dynamic but fixed set of records. New records that meet the selection criteria after the dynaset-type recordset has been created are not added to the recordset. This includes records that other users add.
Snapshot-type recordsets, consisting of a static copy of a set of records. A snapshot reflects the state of the data at a particular moment, the moment the snapshot is taken. This behavior is ideal for reporting.
Note   Because it takes time to retrieve the records for a snapshot, the moment at which the snapshot occurs is not instantaneous.
Ø Characteristics of Recordset Types
Characteristic
Table-Type
Dynaset-Type
Snapshot-Type
Based On
A base table
A query
A query
Updatable
Yes
Yes
No
Dynamic
Yes
Yes
No
Best Uses
Working with a single table (in a non-ODBC database).
Working with records, possibly containing fields from one or more tables. Reflects changes by other users and is updatable.
Finding data or preparing reports. Reflects the state of the data at the time of the snapshot.
Limitations
Can use only with .MDB databases or ISAM (indexed sequential access method) tables opened directly.
Doesn’t reflect new records that meet selection criteria after the recordset opens.
Not updatable. The snapshot is not quite instantaneous.


No comments:
Write comments