RAD Studio
|
When you want to represent all of the fields and all of the records in a single underlying database table, you can use either TSQLDataSet or TSQLTable to generate the query for you rather than writing the SQL yourself.
To make TSQLDataSet generate a query to fetch all fields and all records of a single database table, set the CommandType property to ctTable.
When CommandType is ctTable, TSQLDataSet generates a query based on the values of two properties:
SQLDataSet1.CommandType := ctTable; SQLDataSet1.CommandText := 'Employee'; SQLDataSet1.SortFieldNames := 'HireDate,Salary'
SQLDataSet1->CommandType = ctTable; SQLDataSet1->CommandText = "Employee"; SQLDataSet1->SortFieldNames = "HireDate,Salary"
TSQLDataSet generates the following query, which lists all the records in the Employee table, sorted by HireDate and, within HireDate, by Salary:
select * from Employee order by HireDate, Salary
When using TSQLTable, specify the table you want using the TableName property.
To specify the order of fields in the dataset, you must specify an index. There are two ways to do this:
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
|
What do you think about this topic? Send feedback!
|