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

Getting Started: Steps to Accessing Oracle Data

See Also
Quick Tour
Employee Form

Before we can manipulate server data, our Visual Basic code must first complete the following steps, typically in the Form_Load() procedure:
  1. Start the Oracle in Process Server.
See Starting the Oracle In Process Server

2. Connect to the Oracle database.

See Connecting to the Oracle Database

3. Create a global OraDynaset object to manipulate data.

See Creating a Dynaset

4. Refresh the Employee form with dynaset data.

See Refreshing Screen Data

In our example employee application, the Form_Load() procedure creates the OIP server, connects to the database, creates a global dynaset, and calls the function EmpRefresh to display the field values on the Employee form. The code for Form_Load() looks like:

Private Sub Form_Load()

'OraSession and OraDatabase are global

Set OraSession = CreateObject("OracleInProcServer.XOraSession")

Set OraDatabase = OraSession.OpenDatabase("Exampledb", "scott/tiger", 0&)

Set EmpDynaset = OraDatabase.CreateDynaset("select * from emp", 0&)

Call EmpRefresh

End Sub

The following variables are defined globally in EMP_QT.BAS:

Global OraSession As Object

Global OraDatabase As Object

Global EmpDynaset As Object