Setting the Maximum Number of Records Downloaded

You can control the amount of data downloaded when you open a view by setting the MaxRecords property. When Visual FoxPro sends a SQL statement to the data source to create a view, the data source builds and stores a result set. The MaxRecords property specifies the maximum number of rows fetched from the remote result set into your view. The default setting is –1, which downloads all rows in the result set.

To control the number of rows downloaded into a view

  • From the Tools menu, choose Options and select the Remote Data tab; then in the Remote view defaults area, next to the Maximum records to fetch box, clear All, enter a value in the text box, and then choose OK.

    -or-

  • Use the MaxRecords property of the DBSETPROP( ) or CURSORSETPROP( ) function.

For example, the following code alters the view definition to limit the number of rows downloaded into the view to 50, regardless of the size of the result set built on the remote data source:

OPEN DATABASE testdata
USE VIEW remote_customer_view
?DBSETPROP ('Remote_customer_view', ;    'View','MaxRecords', 50)

You can use the CURSORSETPROP( ) function to set the MaxRecords limit for an active view.

Tip   You can't use the MaxRecords property to stop a runaway query, because the MaxRecords property doesn't control the building of the result set. Use the QueryTimeOut property to control the execution time on the remote data source.

See Also

Optimization of View Performance | Optimizing Filters and Joins | Creating Queries | Sharing Connections for Multiple Remote Views | Testing a Connection for Busyness