Version: 7.0.0

SQLAllocStmt ​

Function ​

Allocates a statement handle. It can be replaced with SQLAllocHandle.

Prototype ​

c
SQLRETURN SQLAllocStmt(SQLHDBC     ConnectionHandle,    
                       SQLHSTMT    *StatementHandle);

Parameters ​

Table 1 SQLAllocStmt parameters

Keyword

Parameter Description

ConnectionHandle

A valid, already-created database connection handle.

Before calling this function, SQLConnect must have been successfully called to establish a connection.

StatementHandle

A pointer to a variable of type SQLHSTMT. Upon successful function execution, this variable stores the newly allocated statement handle.

Return Values ​

  • SQL_SUCCESS: The call is successful.

  • SQL_SUCCESS_WITH_INFO: Some warning information is present.

  • SQL_ERROR: The statement handle failed to be allocated.

  • SQL_INVALID_HANDLE: The input connection handle is invalid.

NOTE ​

To make the code structure clearer and easier to maintain, it is recommended to use the standard interface SQLAllocHandle instead of SQLAllocStmt to allocate a statement handle.

Example ​

See: Example