Microsoft KB Archive/130298

= INFO: Cursors and the Data Environment on Forms and Reports =

Article ID: 130298

Article Last Modified on 11/17/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q130298



SUMMARY
When you add a table or view to the data environment of a form or report in Visual FoxPro, you may notice that the table is referred to as a cursor. This may be confusing for developers who are accustomed to the version 2.x definition of a cursor as a temporary table.



MORE INFORMATION
The cursor referred to in the data environment is a "cursor object." By adding the table or view as an object, you gain several advantages. During design time, you can specify values for several properties including Exclusive, Alias, ReadOnly, NoDataOnLoad and others. By modifying these properties at design time, control is gained over the behavior of the data within the form, without having to close and reopen files. At run-time, these properties can provide useful information.

A cursor object also has three events (Init, Destroy, and Error). This allows encapsulation of code for each table. You might want to create one table if it does not exist when opened, but generate a dialog box for the user if unable to connect to a remote view in the same form or report.

The cursor object does not create a temporary table. If you modify data, the changes affect the table directly unless buffering is enabled. If buffering is enabled, changes are written to a buffer until they are applied to the source table or view.

