Using Table Type Datasets
Go Up to Understanding Datasets Index
To use a table type dataset
- Place the appropriate dataset component in a data module or on a form, and set its Name property to a unique value appropriate to your application.
- Identify the database server that contains the table you want to use. Each table type dataset does this differently, but typically you specify a database connection component:
- For TTable, specify a TDatabase component or a BDE alias using the DatabaseName property.
- For TADOTable, specify a TADOConnection component using the Connection property.
- For TSQLTable, specify a TSQLConnection component using the SQLConnection property.
- For TIBDataSet, specify a TIBDatabase component using the database property.
- Set the TableName property to the name of the table in the database. You can select tables from a drop-down list if you have already identified a database connection component. For the TIBDataSet component, set the CommandText property to select data from the database table.
- Place a data source component in the data module or on the form, and set its DataSet property to the name of the dataset. The data source component is used to pass a result set from the dataset to data-aware components for display.
Advantages of using table type datasets
The main advantage of using table type datasets is the availability of indexes. Indexes enable your application to
- Sort the Records in the Dataset.
- Locate Records Quickly.
- Limit the Records That are Visible.
- Establish Master/Detail Relationships.
In addition, the one-to-one relationship between table type datasets and database tables enables many of them to be used for
- Controlling Read/Write Access To Tables
- Creating and Deleting Tables
- Emptying Tables
- Synchronizing Tables