Choosing a Cursor Type

   

Because there are many ways for a cursor to interact with the result set and your application, there are many types of cursors that your application can use. As a general rule, your application should use the simplest cursor that provides the required data access. Each additional cursor characteristic beyond the basics (static, read-only, forward-only, scrolling, unbuffered) has a price — either in client memory, network load, or performance. In many cases, the default cursor options generate a far more complex cursor than your application actually needs.

Your cursor type choice depends on how your application uses the result set and on several design considerations, including the size of the result set, the percentage of the data likely to be used, sensitivity to data changes, and application performance requirements.

At its most basic, your cursor choice depends on whether you need to change or simply view the data:

Although each cursor type seems to be distinct, keep in mind that these cursor types are not so much different varieties as simply the result of overlapping characteristics and options.

Information in the following topics will acquaint you with the available cursor types.

Section Description
Forward-Only Cursors Describes how the forward-only cursor moves forward serially from the start to the end of the result set, and is sensitive to changes in the underlying result set for only the current row.
Scrollable Cursors Describes how the scrollable cursor can move forward and backward in the result set.
Static Cursors Describes how the static cursor can move forward and backward in the result set and is usually not sensitive to changes in the underlying result set.
Keyset-Driven Cursors Describes how the keyset-driven cursor can move forward and backward in the result set, move directly to a specific row, and, under certain circumstances, detect some types of changes to the underlying result set.
Dynamic Cursors Describes how the dynamic cursor can move forward and backward in the result set and is sensitive to all changes made to rows in the result set.
Mixed Cursors Describes how the mixed cursor combines the features of both a keyset-driven and dynamic cursor.
Recordset Cursors(DAO) Describes the types of cursors available to applications that use the Data Access Objects (DAO) Recordset object.
Recordset Cursors(ADO) Describes the types of cursors available to applications that use the ActiveX™ Data Objects (DAO) Recordset object.