Skip to content

SQLExecute - cBaseSQLExecutor

Executes a prepared SQL query and returns a result set

Type: Function
Return Data Type: Variant

Syntax

Function SQLExecute Returns Variant

Call Example

Get SQLExecute to VariantVariable

Description

Call SQLExecute to execute a prepared SQL query and return a result set.

The result set can be fetched into the following types: String, Variant, Struct, tWebRow, and tDataSourceRow. The destination array for String and Variant should be defined as a two-dimensional array and the array for Structs, tWebRow and tDataSourceRow should be defined as one dimensional array.

See cSQLExecutor for more information about result sets.

Call the Procedure with the same name, SQLExecute, to use it without a result set.

Example of SQLExecute With Result Set

String[][] aResults

// Prepare the query
Send SQLPrepare of ghoSQLExecutor @SQL"SELECT
    Name,  
    City,
    Zip
    FROM Customer"

// Test for errors
If (not(Err)) Begin
    // Fetch the results into aResults
    Get SQLExecute of ghoSQLExecutor to aResults
End

See Also

SQLPrepare | Embedded SQL API

Return Value

Result set