Skip Headers

Oracle® Objects for OLE Developer's Guide
Release 9.2.0.4

Part Number B10952-01
Go To Table Of Contents
Contents

GetRows Example

The following example retrieves data using GetRows method.

Dim OraSession As OraSession

Dim OraDatabase As OraDatabase

Dim OraDynaset As OraDynaset

Dim row, col As Integer

Dim fields() As String

'Create the OraSession Object

Set OraSession = CreateObject("OracleInProcServer.XOraSession")

'Create the OraDatabase Object by opening a connection to Oracle

Set OraDatabase = OraSession.OpenDatabase("ExampleDb",

"scott/tiger", 0&)

Set OraDynaset = OraDatabase.CreateDynaset("select * from emp", 0&)

'The following line executes GetRows to get all records

data_array = OraDynaset.GetRows()

'Now display all the data in data_array

For row = 0 To UBound(data_array, 2)

For col = 0 To UBound(data_array, 1)

MsgBox data_array(col, row)

Next col

Next row

'The following lines execute GetRows to get the data from

'the ename and empno fields starting at 5

ReDim fields(2)

fields(0) = "EMPNO"

fields(1) = "ENAME"

'Execute GetRows

data_array = OraDynaset.GetRows(, 5, fields)

'Now display all the data in data_array

For row = 0 To UBound(data_array, 2)

For col = 0 To UBound(data_array, 1)

MsgBox data_array(col, row)

Next col

Next row


 
Oracle
Copyright © 1994, 2003 Oracle Corporation.

All Rights Reserved.
Go To Table Of Contents
Contents