Skip Headers
Oracle® Objects for OLE Developer's Guide
11g Release 2 (11.2) for Microsoft Windows

Part Number E17727-03
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

Count (OraObject/Ref) Property

Applies To

OraObject Object

OraRef Object

Description

Returns the number of OraAttribute objects in the collection. This is same as the total number of attributes of the underlying referenceable object of OraRef or underlying value instance of OraObject. Read-only at run time.

Usage

attrcount = OraRef.Count  
attrcount = OraObject.Count 

Data Type

Integer

Remarks

Individual attributes can be accessed by using a subscript or the name of the attribute. The OraObject or OraRef attribute index starts at 1.

Examples

The following example shows the use of the Count property. Before running the sample code, make sure that you have the necessary data types and tables in the database. See "Schema Objects Used in the OraObject and OraRef Examples".

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