Using TSQLQuery

From RAD Studio
Jump to: navigation, search

Go Up to How To Perform Database Procedures

TSQLQuery represents a query that is executed using dbExpress. TSQLQuery can represent the results of a SELECT statement or perform actions on the database server using statements such as INSERT, DELETE, UPDATE, ALTER TABLE, and so on. You can add a TSQLQuery component to a form at design time, or create one dynamically at run time.

To use TSQLQuery

  1. From the dbExpress category of the Tool Palette, drag a TSQLQuery component to the form.
  2. In the Object Inspector, set its Name property to a unique value appropriate to your application.
  3. Set the SQLConnection property.
  4. Click the ellipsis button next to the SQL property of the TSQLQuery component. The String List editor opens.
  5. In the String List editor, type the query statement you want to execute.
  6. If the query data is to be used with visual data controls, add a data source component to the form.
  7. Set the DataSet property of the data source component to the query-type dataset.
  8. To activate the query component, set the Active property to True or call the Open method at run time.

See Also