NoDataOnLoad

This cursor property helps forms involving views appear on the screen more quickly by deferring the actual population of the view until you ask for it.

Usage

crsCursor.NoDataOnLoad = lDontLoadIt
lDontLoadIt = crsCursor.NoDataOnLoad
NoDataOnLoad corresponds directly to the NODATA clause of USE. The point is to get the data source to build the structure of the view without bothering to send the data along. When NoDataOnLoad is .T., FoxPro sends the view's query to the data source, but adds specific code to tell the data source not to return any records. With SQL Server, it uses the SET FMTONLY ON command; with other servers, it may resort to a trick such as "WHERE 1=0." Most remote data sources are smart and process a query like that one quickly. A few data sources are stupid and do a whole lot of work before they notice there are no records to return. You'll need to test against your planned server to find out how smart it is, in this case.This property also affects local views. However, you might not see the difference unless the view is based on fairly large tables. With small tables, things happen so fast that this difference is negligible.However, a good use of NoDataOnLoad is for parameterized views where the parameter may not be known until the remainder of the form is running, or even until the operator selects a value. A parameterized view with NoDataOnLoad set to .T. doesn't prompt for the parameter, but still returns the initial structure used to bind controls.

Example

* This property is pretty much always set in the property sheet
* but you can do it like this:
ThisForm.DataEnvironment.Cursor1.NoDataOnLoad = .T.

See Also

Cursor, Use


Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .