Executing Queries
|
Previous Top Next |
1. | Place TABSDatabase and TABSQuery components from the Absolute DB page of the Component palette to a data module or on a form, if you have not already done it.
|
2. | Set up TABSDatabase component. Set the TABSDatabase.DatabaseName of the component to a unique value that will be used later to identify the database. Set the TABSDatabase.DatabaseFileName property to the name of the existing or new database file, if you have not already done it.
|
3. | Set up TABSQuery component. Set the TABSQuery.DatabaseName property from the drop-down list of available TABSDatabase components. Assign the query command(s) to the TABSQuery.SQL property. If you'd like a query to return a modifiable records set, set TABSQuery.RequestLive property to True.
|
4. | Connect to a database (optional).
|
· | If a query returns records set, i.e. SELECT command, set the Active property of the query to True, either at design time in the Object Inspector, or in code at runtime: ABSQuery1.Active := True; or call the Open method for the query at runtime, ABSQuery1.Open;
|
· | If a query doesn't return records, i.e. INSERT, UPDATE, etc., call the ExecSQL method for the query at runtime, ABSQuery1.ExecSQL;
|