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: Creating an OraRef

The following example illustrates the use of the CreateOraObject method to insert referenceable objects. 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.

In this example a new "PERSON" is inserted as a referenceable object in the server.

Dim OraSession as OraSession

Dim OraDatabase as OraDatabase

Dim Person as OraRef

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

'CreteOraObject creates a new referenceable

'object in the PERSON_TAB object table and returns associated OraRef

set Person = OraDatabase.CreateOraObject("PERSON","PERSON_TAB")

'modify the attributes of Person

Person.Name = "Eric"

Person.Age = 35

'Update method inserts modified referenceable object in the PERSON_TAB.

Person.Update