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

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, 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