Visual Basic Concepts

Positioning the Current Row Pointer

At any one time, only one row in an rdoResultset is exposed for data retrieval or modification: the row addressed by the current row pointer. You move the current row pointer from row to row by using one of the methods or properties as shown in the table below. Each of these methods implies a starting location, and the reposition is made relative to that location. In some cases the current row pointer will be indeterminate or positioned beyond either end of the result set. In these cases, there is no current row, so no attempt should be made to reference the data columns or update the row. In other cases (as with forward-only result sets), you will not be permitted to move backwards in the result set or even to the end with the MoveLast method. Generally, this is because of your choice of cursor.

Methods and Properties that Reposition the Current Row Pointer

RDO Methods and Properties Move to the rdoResultset object's … Relative to…in the rdoResultset
MoveFirst First row Anywhere
MoveNext Current row + 1 Current row
MovePrevious Current row – 1 Current row
MoveLast Last row Anywhere
Move 'n' th row forward or back Current row
PercentPosition % of populated rows First row
AbsolutePosition 'n' th row First row
Bookmark A presaved location Anywhere
LastModified A presaved location set by RDO Anywhere

Tip   Using the Move method with a 0 argument simply refetches the current row.

Note   You cannot use a bookmark to reposition the current row pointer if the BOF or EOF properties are True. If you are working with a scrollable rdoResultset and you wish to reposition to a bookmark, use the MoveFirst method or another Move method to reposition back into the result set.

If the rdoResultset object supports bookmarks, these can be used to save the current location in a Variant variable. You can subsequently position back to a saved location in the rdoResultset by setting the Bookmark property with a bookmark. The LastModified property is also returned in the form of a bookmark that can be applied to the Bookmark property to reposition back to the last row changed or added.

Note   When using forward-only rdoResultset objects, you can only use the MoveNext method. Other repositioning techniques are not supported. You can, however, use the Close method to close the result set or use the MoreResults method to terminate processing of the current rdoResultset object at any time.

Be sure to check the EOF and BOF properties to determine if the current row is positioned beyond the end or beginning of the result set. When using the Bookmark property to reposition the current row, it is possible to reposition to a row that has been deleted by another user. If this occurs, a trappable error results and you must reposition to another valid row.

For More Information   See "BOF Property," "EOF Property," "AbsolutePosition Property," "PercentPosition Property," and "Move" in the Language Reference".

Enabling the Asynchronous RDO MoveLast Method

If at all possible, you should execute the MoveLast method as soon as you can to fully populate your result set. When MoveLast has positioned to the last row in the result set, the statement handle is freed and any residual page or row locks are released by the remote server.

By setting the rdAsyncEnable option when using MoveLast, RDO returns control to your application immediately to prevent unneeded lockups. In this case, the rdoResultset data is unavailable until the StillExecuting property returns False. At this point, the QueryComplete event is also fired.