Visual Basic Concepts

Working with RDO Result Sets

Once the rdoResultset is created, you can begin to access the data values it contains. When working with any result set there are a few points to keep in mind:

Setting RDO Cursor Limits

You can limit the number of rows returned by a query by creating an rdoQuery and setting the MaxRows property. Once the query processor returns MaxRows rows, it stops working on the query. This is an especially easy way to govern the number of rows returned from ad hoc queries.

Note   The MaxRows property also affects data modification queries. For example, if MaxRows is set to 100, and you execute an action query such as an UPDATE statement, only the first 100 qualifying rows are updated.

Determining How Many Rows Are Returned

Generally, you can use the RowCount property to determine the number of rows that qualified to be members of your result set. When you access this property, RDO basically executes a MoveLast method to fully populate the result set before returning to your application. This operation is not performed asynchronously, so your application might block while the query is completed. In some cases, there is no RowCount support from ODBC, so the property returns –1.

Handling RDO QueryTimeout Events

To limit the amount of time the query processor works on a query, set the QueryTimeout property on the rdoConnection or rdoQuery. Once the QueryTimeout period expires, the QueryTimeout event fires. This event is fired each time the QueryTimeout time is reached — whether or not you are using the rdAsyncEnable option.

Your event handler has the choice of continuing or canceling the asynchronous query operation. If you or your user decide to continue working and wait for another QueryTimeout period, pass False to the Cancel parameter. Changes to the QueryTimeout property do not take effect until you start another query.

If you do not code a QueryTimeout event procedure, the query is canceled, the StillExecuting property is set to False, and control returns to the application.