Oracle Objects for OLE
Release 9.2

Part Number A95895-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents

Master Index

Feedback

MovePreviousn, MoveNextn, MoveRel, MoveTo Methods

Applies To

OraDynaset Object

Description

These methods change the cursor position to the specified row within the specified dynaset.

Usage

oradynaset.MovePreviousn offset

oradynaset.MoveNextn offset

oradynaset.MoveRel offset

oradynaset.MoveTo offset

MoveNextn Method

Move offset records forward.

MovePreviousn Method

Move offset records backward.

MoveRel Method

Move offset records relative to current row. A positive value (represented by a "+" sign) will move the cursor "down" the table, and vice versa.

MoveTo Method

Move directly to row number offset.

Remarks

EOF will be set when cursor moves beyond the end of dynaset using MoveNextn, MoveRel, MoveTo methods. BOF will be set when cursor moves beyond the start of dynaset using MovePreviousn, MoveRel, MoveTo method. MoveNextn, MovePreviousn, MoveTo accepts offset as a positive integer only. MoveRel accepts offset as both positive and negative integer.

Note:

MoveTo rownum always gets the same row unless the row has been deleted. If the row has been deleted, MoveTo moves to the next valid row after the one requested. MoveNextn, MovePreviousn, etc. do not take into account deleted rows so you should be cautious when using these methods based on relative positions of rownums.

DataType

Long Integer

Example

This example demonstrates the use of MovePreviousn, MoveNextn, MoveRel, MoveTo method. Copy and paste this code into the definition section of a form. Then press F5.

Private Sub Form_Load()

Dim OraSession As OraSession

Dim OraDatabase As OraDatabase

Dim OraDynaset As OraDynaset

Dim OraFields As OraFields

Set OraSession = CreateObject("OracleInProcServer.XOraSession")

Set OraDatabase = OraSession.OpenDatabase("ExampleDb", "SCOTT/TIGER", 0&)

Set OraDynaset = OraDatabase.CreateDynaset("select * from emp where empno >=7654 and empno <= 7844 ", ORADYN_NO_BLANKSTRIP)

Set OraFields = OraDynaset.Fields

'Move to 3rd record from the first record

OraDynaset.MoveNextn 3 'Should set EOF to true

MsgBox OraFields("ename").Value ' Should be display SCOTT

If OraDynaset.EOF = True Then

MsgBox "End of the record reached"

End If

'Move back from the current record by the offset 2

OraDynaset.MovePreviousn 2

MsgBox OraFields("ename").Value ' Should be display BLAKE

If OraDynaset.BOF = True Then

MsgBox "Start of the record reached"

End If

'Move relative in the forward direction

OraDynaset.MoveRel 2

MsgBox OraFields("ename").Value ' Should be display SCOTT

If OraDynaset.EOF = True Then

MsgBox "End of the record reached"

End If

'Move relative in the backward direction

OraDynaset.MoveRel -2

MsgBox OraFields("ename").Value ' Should be display BLAKE

If OraDynaset.BOF = True Then

MsgBox "Start of the record reached"

End If

'Move to the record position 4 in the current dynaset

OraDynaset.MoveTo 4

MsgBox OraFields("ename").Value ' Should be display SCOTT

End Sub


 
Oracle
Copyright © 1994, 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents

Master Index

Feedback