Version: 7.0.0

SQLExecDirect ​

Function ​

Executes a prepared statement using the current parameter values. For executing a single SQL statement at a time, SQLExecDirect is the fastest execution method.

Prototype ​

c
SQLRETURN SQLExecDirect(SQLHSTMT        StatementHandle,
                        SQLCHAR         *StatementText,     
                        SQLINTEGER      TextLength);

Parameters ​

Table 1 SQLExecDirect parameters

Keyword

Parameter Description

StatementHandle

Statement handle, obtained through SQLAllocHandle.

StatementText

SQL statement to be executed. Executing multiple statements at once is not supported.

TextLength

Length of StatementText.

Return Values ​

  • SQL_SUCCESS: The call is successful.

  • SQL_SUCCESS_WITH_INFO: Some warning information is present.

  • SQL_ERROR: The statement execution failed.

  • SQL_INVALID_HANDLE: The input handle is invalid.

  • SQL_NO_DATA: The SQL statement does not return a result set.

Example ​

See: Example