Oracle Objects for OLE
Release 8.1.7

Part Number A85257-01

Library

Product

Contents

RecordSource Property Example

This example demonstrates the use of SQL bind variables (parameters) in the RecordSource property of the data control. To run this demonstration:

  1. Copy this code into the definition section of a form containing a data control named oradata1.

  2. Press F5.

Sub Form_Load ()

'Set the username and password.

oradata1.Connect = "scott/tiger"

'Set the databasename.

oradata1.DatabaseName = "ExampleDb"

'Refresh the data control without setting the

' RecordSource. This has the effect of creating

' the underlying database object so that parameters

' may be added.

oradata1.Refresh

'Set the RecordSource and use a SQL parameter.

oradata1.RecordSource = "select * from emp where job = :job"

'Add the job input parameter with initial value MANAGER.

oradata1.Database.Parameters.Add "job", "MANAGER", 1

'Refresh the data control.

'Only employees with the job MANAGER will be contained

'in the dynaset.

oradata1.Refresh

'Change the value of the job parameter to SALESMAN.

oradata1.Database.Parameters("job").Value = "SALESMAN"

'Refresh ONLY the recordset.

'Only employees with the job SALESMAN will be contained

' in the dynaset.

oradata1.Recordset.Refresh

End Sub


 
Oracle
Copyright copy; 1996-2000, Oracle Corporation.

All Rights Reserved.

Library

Product

Contents