Complex data binding refers to components that interact directly with a recordset. A complex data-bound component provides dataSource and dataMember properties that identify the recordset it is bound to. Note that the properties of complex bound components can still be simple bound by means of the DataBinder component.
The dataSource property identifies an object that implements the IDataSource interface. This object exposes one or more recordsets. The dataMember property then specifies the name of the recordset that is currently bound to the component. For example:
// Bind the component to the recordset named "Products", // which is exposed by the data source, ds. dbComponent.setDataSource(ds); dbComponent.setDataMember("Products");
If you do not set the dataMember property, the data source’s default recordset will be bound. (You can explicitly specify the default recordset by setting the dataMember property to null.)
// Bind the component to the default recordset // exposed by the data source, ds. dbComponent.setDataSource(ds); dbComponent.setDataMember(null); // This line is optional.
Note that the Recordset and DataSource components already implement the IDataSource interface. You can therefore set the dataSource property directly to one of these components. In this case, you do not have to set the dataMember property.
// Set the dataSource property directly to the Recordset // component,rs, without setting the dataMember property. dbComponent.setDataSource(rs);