Specifying What Data to Display

From RAD Studio
Jump to: navigation, search

Go Up to Using dbExpress Components Index


There are a number of ways to specify what data a dbExpress dataset represents. Which method you choose depends on the Types of dbExpress Datasets you are using and whether the information comes from a single database table, the results of a query, or from a stored procedure.

When you work with a Data.SqlExpr.TSQLDataSet component, use the CommandType property to indicate where the dataset gets its data. CommandType can take any of the following values:

  • ctQuery: When CommandType is ctQuery, TSQLDataSet executes a query you specify. If the query is a SELECT command, the dataset contains the resulting set of records.
  • ctTable: When CommandType is ctTable, TSQLDataSet retrieves all of the records from a specified table.
  • ctStoredProc: When CommandType is ctStoredProc, TSQLDataSet executes a stored procedure. If the stored procedure returns a cursor, the dataset contains the returned records.

The following topics describe how you can specify a set of records for each type of source:

Note: You can also populate the unidirectional dataset with metadata about what is available on the server. For information on how to do this, see Fetching metadata into a dbExpress dataset.

See Also