Читайте также: |
|
The Data Access page of the Delphi Component palette provides a set of database encapsulation objects that simplify database access.
Figure 1.4 Data Access page of the Component palette
When building a database application, you place data access components on a form, and then assign them properties that specify the database, table, and records to access. They provide the connection between a data source and Data Control components.
At run time, after an application is built and compiled, data access objects are not visible, but are “under the hood,” where they manage data access.
The following table lists the data access objects on the Data Access page, and briefly describes how they are used:
Table 1.4. Data Access components
Component | Purpose |
TDataSource | Acts as a conduit between a TTable, TQuery, TStoredProc component and data-aware components, such as TDBGrid. |
TTable | Retrieves data from a database table via the BDE and supplies it to one or more data- aware components through a TDataSource component. Sends data received from a component to a database via the BDE. |
TQuery | Uses SQL statements to retrieve data from a database table via the BDE and supplies it to one or more data-aware components through a TDataSource component, or uses SQL statements to send data from a component to a database via the BDE. |
TStoredProc | Enables an application to access server stored procedures. Sends data received from a component to a database via the BDE. |
TDatabase | Sets up a persistent connection to a database, especially a remote database requiring a user login and password. |
TBatchMove | Copies a table structure or its data. Can be used to move entire tables from one database format to another. |
TReport | Enables printing and viewing of database reports through ReportSmith. |
Four data access components deserve special mention. Most forms provide a link to a database with a TTable or TQuery component (or through a user-defined component based on the normally hidden abstract class, TDataSet, of which TTable and TQuery are descendents). Other forms provide a link to a database with TStoredProc, also a descendent of TDataSet. In turn, all forms must provide a TDataSource component to link a TTable, TQuery, or TStoredProc component to data control components that provide the visible user interface to the data.
TTable, TQuery, (and TStoredProc, when it returns a result set) contain a collection of TField components. Each TField corresponds to a column or field in the table or query. TFields are created
• Automatically, when TTable, TQuery, or TStoredProc are activated.
• At design time, using the Fields editor.
Дата добавления: 2015-10-26; просмотров: 105 | Нарушение авторских прав
<== предыдущая страница | | | следующая страница ==> |
Database components architecture | | | Overview of the Data Controls page |