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

E17727-04
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

AutoBindEnable Method

Description

Sets the AutoBind status of a parameter.

Usage

oraparameter.AutoBindEnable

Remarks

If a parameter has AutoBindEnabled status, it is automatically bound to a SQL or PL/SQL statement.

Examples

This example demonstrates the use of the AutoBindDisable and AutoBindEnable methods to prevent unnecessary parameter binding while creating various dynasets that use different parameters. Copy this code into the definition section of a form. Then, press F5.

Sub Form_Load ()
 
 'Declare variables
 Dim OraSession As OraSession 
 Dim OraDatabase As OraDatabase 
 Dim OraDynaset As OraDynaset 
 
 '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&)
 
 'Add the job input parameter with initial value MANAGER.
 OraDatabase.Parameters.Add "job", "MANAGER", 1
 
 'Add the deptno input parameter with initial value 10.
 OraDatabase.Parameters.Add "deptno", 10, 1
 
 'Disable the deptno parameter for now.
 OraDatabase.Parameters("deptno").AutoBindDisable
 
 'Create the OraDynaset Object using the job parameter.
 Set OraDynaset = OraDatabase.CreateDynaset("select * from emp" & _ 
                 "where job = :job", 0&)
 
 'Only employees with job=MANAGER will be contained in the dynaset.
 MsgBox "Employee #" & OraDynaset.Fields("empno").value & "," &  _
                 "Job=" & OraDynaset.Fields("job").value
 
 'Enable the deptno parameter and disable the job parameter.
 OraDatabase.Parameters("deptno").AutoBindEnable
 OraDatabase.Parameters("job").AutoBindDisable
 
 'Create the OraDynaset Object using the deptno parameter.
 Set OraDynaset = OraDatabase.CreateDynaset("select * from emp" & _ 
                  "where deptno = :deptno", 0&)
 
 'Only employees with deptno=10 will be contained in the dynaset.
 MsgBox "Employee #" & OraDynaset.Fields("empno").value & "," & _
                  "DeptNo=" & OraDynaset.Fields("deptno").value
 
End Sub