Skip Headers

Oracle® Objects for OLE Developer's Guide
10g Release 1 (10.1)

Part Number B10118-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Master Index
Master Index
Go to Feedback page
Feedback

Example: Count (OraObject) Property

The following example shows the usage of the Count property. Before running the sample code, make sure that you have the necessary datatypes and tables in the database. See Schema Description used in examples of OraObject/OraRef.

Dim OraSession as OraSession

Dim OraDatabase as OraDatabase

Dim OraDynaset as OraDynaset

Dim Address as OraObject

'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&)

'create a dynaset object from person_tab

set OraDynaset = OraDatabase.CreateDynaset("select * from

person_tab",0&)

'retrieve a address column from person_tab.

'Here Value property of OraField object

'returns Address OraObject

set Address = OraDynaset.Fields("Addr").Value

'access the attribute by dot notation

msgbox Address.Street

'access the attribute using '!' notation ( early binding application)

msgbox Address!Street

'access the attribute by index

msgbox Address(1)

'access the attribute by name

msgbox Address("Street")

'access all the attributes of Address OraObject in the dynaset

Do Until OraDynaset.EOF

For index = 1 To Address.Count

msgbox Address(index)

Next Index

OraDynaset.MoveNext

Loop