Oracle® Objects for OLE C++ Class Library Developer's Guide 10g Release 2 (10.2) Part Number B14308-01 |
|
Applies To
Description
This method binds the OBound object to a particular OBinder object.
Usage
oresult BindToBinder(OBinder *binder, const char *fieldname)
Arguments
Argument |
Description |
---|---|
binder | A pointer to the OBinder object to which this OBound should be bound. |
fieldname | The name of the field in the query to which this OBound should be bound. |
Before an OBound object is associated with an OBinder (a managed dynaset), it is inert. BindToBinder sets up the relationship between the OBound object and the OBinder object that makes the OBound machinery work.
This method calls the Startup trigger for the OBound object and the OBinder Startup trigger if this is the first object to be bound.
If the OBinder object is already open, BindToBinder verifies that the fieldname is valid and returns OFAILURE if the fieldname does not belong to the bound dynaset. However, your Bound Controls will not receive their values until they are refreshed, either by using the OBinder::Refresh method or one of the Move methods.(such as MoveFirst) It is also possible to bind all the OBound objects before opening the OBinder. In this situation, OBinder Open fails if there are any OBound objects referring to an invalid fieldname.
Return Value
An oresult indicating whether the operation succeeded (OSUCCESS) or not (OFAILURE).
Example
This example does all the work needed to set up several OBoundVal objects that will be bound to several fields in the emp table. OBoundVal is a subclass of OBound that is discussed in the Workbook.
// open a database object ODatabase odb("ExampleDB", "scott", "tiger"); // open the managed dynaset OBinder empblock; empblock.Open(odb, "select ename, sal, empno from emp"); // declare some OBoundVal objects OBoundVal ename; OBoundVal sal; OBoundVal empno; // bind the OBoundVals ename.BindToBinder(&empblock, "ename"); sal.BindToBinder(&empblock, "sal"); empno.BindToBinder(&empblock, "empno"); // now we're all set up