Cursor not in a valid state

Item Value
SQLCODE -853
Constant SQLE_CURSOR_INVALID_STATE
SQLSTATE 24000
Sybase error code 557
ODBC 2 State 24000
ODBC 3 State 24000

Probable cause 

You attempted to use a cursor that is not in a valid state for the attempted operation. For example, the cursor may have encountered an error.