DataControl

Object List Hierarchy Next Object

Definition:

The DataControl is the link between Phoenix's controls and a database that lets you access data without writing code. Once you've attached a DataControl to a database, you then bind data-aware controls to the DataControl. If you make changes to data in a bound control, the changes are saved as you move to another record.

Icon: images/Phx00230.gif

Specialized Features:


Properties Use to...


ButtonScale Control the proportional size of the DataControl.

Recordset Provide an embedded RecordSet object that supports a DataControl's underlying data.


Methods Use to...


DataMoveFirst Position the RecordSet to reference the first data record.

DataMoveLast Position the RecordSet to reference the last data record.

DataMoveNext Position the RecordSet to reference the next data record.

DataMovePrev Position the RecordSet to reference the previous data record.

Resize Resize the DataControl when the form size is changed.

Copied Features:

images/Phx00231.gif Properties images/Phx00232.gif Methods images/Phx00233.gif Events

Details:

Use the DataControl to perform most of your data access operations without writing any code. The DataControl allows you to easily move from record to record and display data from each record in bound controls as you proceed. You can select the type of data you would like to access, create or modify a record, and update the source.


Note: To bind controls to a DataControl, use the control's DataSource and DataField properties while in Edit mode. Bound controls are not allowed on a form, however, unless you have a DataControl. The most common control that is bound to DataControls is a TextBox.

Bound controls automatically display data from a specified field in the current record. When a DataControl advances to another record, all bound controls automatically change to display their corresponding fields of that record. When a DataControl moves to another record it also automatically saves any changes that a user may have made to data or to a DataControl through a bound control.

The DataControl is a HyperControl, which contains several individual Button controls. The RecordSet property is an embedded "data access" object. You can use the properties and methods of the RecordSet along with the DataControl to help manipulate and manage your data. When a record is changed by the DataControl, an Update event is triggered, which sends corresponding data fields from the RecordSet to controls that have associated DataField properties. Of course, the bound controls must have their DataSource property referencing the DataControl's RecordSet object.

If data inside a control changes, the control's DataChanged property is set to True. When the RecordSet moves to a different record, the UpdateDataSource event is triggered on the control, which updates the changed information to the corresponding field of the RecordSet.