Closing Cursors

Cursors are automatically closed if you commit or roll back the transaction. The SQL Server driver provides a driver-specific connection option, SQL_PRESERVE_CURSORS, to override this behavior for server cursors. If this option is set to SQL_PC_ON, cursors remain open and the cursor state is preserved across transaction commits or rollbacks.

The following ODBC functions are relevant:

SQLFreeStmt

SQLTransact