Skip Headers

Oracle® Objects for OLE Developer's Guide
Release 9.2.0.4

Part Number B10952-01
Go To Table Of Contents
Contents

Find Methods Example

This example demonstrates the use of the FindFirst, FindNext, FindPrevious methods. Copy and paste this code into the definition section of a form. Then press F5.

Sub Form_Load ()

Dim OraSession As OraSession

Dim OraDatabase As OraDatabase

Dim OraDynaset As OraDynaset

Dim OraFields As OraFields

Dim FindClause As String

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

OraDynaset.MoveFirst

'FindClause for job as MANAGER

FindClause = "job LIKE '%GER'"

OraDynaset.FindFirst FindClause

'NoMatch property set to true , if no rows found

If OraDynaset.NoMatch Then

MsgBox "Couldn't find rows "

else

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

OraDynaset.FindNext FindClause

MsgBox OraFields("ename").Value ' Should display CLARK

OraDynaset.FindPrevious FindClause

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

endif

End Sub


 
Oracle
Copyright © 1994, 2003 Oracle Corporation.

All Rights Reserved.
Go To Table Of Contents
Contents