Oracle Objects for OLE
Release 9.2

Part Number A95895-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents

Master Index

Feedback

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 © 1994, 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents

Master Index

Feedback