In this blog post, you’ll learn more about the Sybase Error Cursor not in a valid state and the reason for receiving this error
Sybase SQL Error Message
Cursor not in a valid state
Reason for this Error
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. In UltraLite, this error occurs if you attempt to set parameters for a prepared statement while a result set (cursor) is open for the statement.