RAD Studio
ContentsIndex
PreviousUpNext
Specifying the Data to Display using TSQLDataSet
To specify the data to display
  1. Choose FileNewOther. The New Items dialog appears.
  2. In the New Items dialog, select Delphi Projects and double-click VCL Forms Application. The Windows Designer displays.
  3. From the dbExpress category of the Tool Palette, drag a TSQLDataSet component to the form.
  4. For TSQLDataSet, specify the type of unidirectional dataset by CommandType property in the Object Inspector.
  5. Specify whether information comes from results of query, a database table, or a stored procedure.
To display results from a query
  1. Set the CommandType property to ctQuery for a TSQLDataSet.
  2. For TSQLQuery, drag a TSQLQuery component from the Tool Palette to the form.
  3. Set the SQL property to the query you want to assign.
  4. Select TSQLDataSet.
  5. Click the CommandText property. The CommandText Editor opens.
  6. In the CommandText Editor, set the SQL property to the text of the query statement.

Note: When you specify the query, it can include parameters, or variables, the values of which can be varied at design time or runtime. Parameters can replace data values that appear in the SQL statement. SQL defines queries such as UPDATE queries that perform actions on the server but do not return records.

To display records in a table
  1. In the Object Inspector, set the CommandType property to ctTable. TSQLDataSet generates a query based on the values of two properties: CommandText that specifies the name of the database table that the TSQLDataSet object should represent and SortFieldNames that lists the names of any fields to use to sort the data, in the order of significance
  2. Drag a TSQLTable component to the form.
  3. In the Object Inspector , set the TableName property to the table you want.
  4. Set the IndexName property to the name of an index defined on the server or set the IndexFieldNames property to a semicolon-delimited list of field names to specify the order of fields in the dataset.
To display the results of a stored procedure
  1. In the Object Inspector, set the CommandType property to ctStoredProc.
  2. Specify the name of the stored procedure as the value of the CommandText property.
  3. Set the StoredProcName property to the name of the stored procedure for TSQLStoredProc.

Note: After you have identified a stored procedure, your application may need to enter values for any input parameters of the stored procedure or retrieve the values of output parameters after you execute the stored procedure.

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!