RAD Studio |  |

Displaying, Converting, and Accessing Field Values
See Also
Collapse All

Data-aware controls such as TDBEdit and TDBGrid automatically display the values associated with field components. If editing is enabled for the dataset and the controls, data-aware controls can also send new and changed values to the database. In general, the built-in properties and methods of data-aware controls enable them to connect to datasets, display values, and make updates without requiring extra programming on your part. Use them whenever possible in your database applications. For more information about data-aware control, see Using data controls.

Standard controls can also display and edit database values associated with field components. Using standard controls, however, may require additional programming on your part. For example, when using standard controls, your application is responsible for tracking when to update controls because field values change. If the dataset has a datasource component, you can use its events to help you do this. In particular, the OnDataChange event lets you know when you may need to update a control's value and the OnStateChange event can help you determine when to enable or disable controls. For more information on these events, see Responding to changes mediated by the data source.

The following topics discuss how to work with field values so that you can display them in standard controls:

- Displaying Field Component Values in Standard Controls
- Converting Field Values
- Accessing Field Values with the Default Dataset Property
- Accessing Field Values with a Dataset's Fields Property
- Accessing Field Values with a Dataset's FieldByName Method

See Also

Working with Field Component Methods at Runtime

Persistent Field Components

Setting a Default Value for a Field

Working with Constraints

Using Object Fields

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!