short ExecuteStoredProcedure(long QueryID, VARIANT* Result, [VARIANT CommitOK], [VARIANT MaxResultSets], [VARIANT ColumnNames], [VARIANT ColumnLabels], [VARIANT ColumnComments])
Description
This function executes an SQL statement that uses the SQL verb CALL to run a stored procedure at the database server. Use ExecuteStoredProcedure() when the stored procedure does not return any results. For stored procedures that return results, use ExecuteStoredProcedureEx().
To initialize a stored procedure for execution with ExecuteStoredProcedure(), call InitializeQuery or InitializeStaticQuery() and specify an SQL statement that uses the CALL statement. The stored procedure name should be specified as a literal in the CALL statement. Any parameters specified in the CALL statement (constant or otherwise) are ignored. Instead, use AddParameter(), AddDecimalParameter(), or SetParameter() to specify the input, output, and input-output parameters.
Parameters
Name | Description |
---|---|
QueryID | The ID of the query, as returned from InitializeQuery() or InitializeStaticQuery(). The SQL text for the query should specify a CALL statement. Specify a negative one (-1) if you want to return all the result sets the stored procedure returns. The default is negative one (-1). |
Result |
A pointer to a VARIANT in which the result will be stored. The result is an array (variant type VT_ARRAY | VT_VARIANT) containing one value for each column in the result. Each value is specified in its native data type or the closest variant data type. The supported return types are:
|
CommitOK | An optional Boolean value specifying whether the stored procedure can commit the unit of work or if this operation should be restricted. The default value is True. |
MaxResultSets | An optional numeric value specifying the maximum number of result sets that the stored procedure should be allowed to return. Specify zero if you do not want the stored procedure to return any result sets or if the database server does not support returning result sets from stored procedures over DRDA. |
ColumnNames | An optional Boolean value specifying whether the database should return column names for the columns in each returned result set. |
ColumnLabels | An optional Boolean value specifying whether the database should return column labels for the columns in each returned result set. |
ColumnComments | An optional Boolean value specifying whether the database should return column comments for the columns in each returned result set. |
Return Value
The return value will be zero if successful or non-zero if unsuccessful. If the return value is non-zero, you can call GetLastErrorString(), GetLastErrorType(), GetLastSQLCode(), GetLastSQLError(), or GetLastSQLState() to get additional error information.
Related Tasks