DQL Object

SQL*XL
home

Class clsStmtDQL is a subclass of:

Statement

Description:

The DQL object encapsulates a select statement. The management of the DQL object is done by the SQL object and a DQL object is an item in the SQL.Statements collection. The index property of the DQL object corresponds to the index in the Statements collection.

To use the DQL object use SQL object to assign a new SQL statement. The SQL object will populate the Statements collection. A reference to the DQL object can be created by using a command like: Set myvar = SQLXL.SQL.Statements(1)

The execute method of the DQL object will run the query and prepare the resultset. The Target property will determine where the output will go. The Target object can be referenced using the Targets collection of the SQLXL object: Set myvar = SQLXL.Targets( litExcel )
The Target object manages the options surrounding the output of the data, e.g. whether column heading should be printed etc.

 

Properties:

Name Data Type Description
OptimiseForLargeQuery As Boolean

When False it returns a flexible resultset which can be used for updates and it can be navigated. When it is navigated more and more memory is needed to store the records.
When set to True a resultset with minimal features is returned. Navigating through this resultset will not grow the memory usage.

ShowParametersDlg As Boolean When parameters are used in the query, setting this property to True will display the Parameters Dialog to take the parameter values.
ShowResultsetDlg As Boolean Set this property to True is you want to display the Resultset Options dialog.
Target As Object Sets the target for the output of the query. Possible values are Targets(litExcel), Targets(litOutlook), Targets(litWord), Targets(litPDF), Targets(litText), Targets(litXLS), Targets(litPivotTable), Table(litNone)
Text As String The text of the SQL Statement

 

Methods:

Name Data Type Description
Execute   Executes the SQL Statement

 

Example:

Show the resultset options dialog to allow the user to specify options for the SQL statement:


SQLXL.SQL.setText Text:="select * from emp;"
Set SQLXL.SQL.Statements(1).Target= Targets(litExcel )
SQLXL.SQL.Statements(1).ShowResultsetDlg = True
SQLXL.SQL.Statements(1).Execute