Oracle Objects for OLE Release 9.2 Part Number A95895-01 |
|
The following example accesses the attributes of the "ADDRESS" value instance in the server. 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
|
Copyright © 1994, 2002 Oracle Corporation. All Rights Reserved. |
|