Before we can manipulate server data, our Visual Basic code must first
complete the following steps, typically in the Form_Load() procedure:
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