Data Access and Transactions

Previous Topic Next Topic

Keyset Cursors

A keyset cursor combines the functionality of the static and dynamic cursor types. It can view all database updates made by other users, and it can search using both absolute and relative positioning. A keyset is a set of values used to access specific rows or records in a database. The “key” is actually based on the database indexes used by the current table. When the database needs to update the cursor’s value, it does so based on the row’s key. Therefore, a “keyset recordset” must include enough columns to ensure unique records in a Recordset that’s being updated.

Under normal circumstances, when you request records from a data source, you get all the data at once. However, when a keyset cursor is used, only the keys are returned, giving a performance boost. The data for the keys is retrieved when you scroll through the recordset. Except for the first query, which returns both keys and data, the next block of data is fetched only when it is needed. This way the cursor only has to manage small keys rather than large records. Therefore, keyset cursors are more suited for use with a Recordset in situations where not all the data will be needed at once.


© 1997-1999 Microsoft Corporation. All rights reserved.