Function for freeing statement handles

You call the SQLFreeHandle() function (with HandleType set to SQL_HANDLE_STMT) to terminate processing for a particular statement handle.

SQLFreeHandle() also performs the following tasks:
  • Unbinds all columns of the result set
  • Unbinds all parameter markers
  • Closes any cursors and discard any pending results
  • Drops the statement handle, and release all associated resources

The statement handle can be reused for other statements provided it is not dropped. If a statement handle is reused for another SQL statement string, any cached access plan for the original statement is discarded.

The columns and parameters must always be unbound before using the handle to process a statement with a different number or type of parameters or a different result set; otherwise application programming errors might occur.