How You Can Use the SetCols Method to Specify the Query
Note that in addition to using parameter substitution, the preceding query differs from previous examples in that it does not specify the columns to be retrieved. Instead it uses the "select *" syntax to retrieve all columns from the customer table.
After loading the SQL text into the Query attribute, you can use the SetCols method to get relevant column information for each column and to initialize the Columns array. The SetCols method also checks the query for syntax errors.
The SetCols method gets information from the database table and assigns it to relevant attributes in the SQLSelect's Columns array. As an array of type QueryCol, the Columns attribute contains the following information:
AsName
Specifies the column name used in the select statement to see the retrieved column (for example, select name as EmpName ...); used in group by or order by clauses
ColumnName
Specifies the name of the database column; required for QueryObject objects but not SQLSelect objects
DataType
Specifies the data type of the database column; supplied or checked by the SetCols and Open methods
DataTypeLength
Specifies the length of the data type; supplied or checked by the SetCols and Open methods
DataTypeNullable
Set to TRUE if the data type is nullable; supplied or checked by the SetCols and Open methods
Targets
Specifies an array of field mappings for each column
Value
Specifies the current column value (valid only if a row has been fetched)
The attributes that contain data type information are assigned directly by invoking the SetCols or Open methods. In addition, if it has not already been filled in, the AsName attribute is also assigned a value by invoking these two methods.