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