WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

ODBC
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Invalid Cursor State Error

Keywords:   statement handle and invalid cursor state

Question:

I have a problem wiht Update Statmants within the ODBC Extender. My Select Query is like this:
	groups = qExecDirect(hstmtgrp,"SELECT * FROM %TableNameGroupDB% WHERE USERNAME = '%username%'")
works without any problems. But a Statement like:
	retcode = qExecDirect(hstmtusr,"UPDATE UserDB SET CreateUser=0")
does not work. The same statement defined in Access97 works fine!

The ErrorMessage I get is:

	24000 [Microsoft][ODBC Driver Manager] Invalid cursor state
I get this error every time no matter how i format the Statement.

Can anybody help me??

Answer:

You cannot reuse the Statement Handle when the cursor is in use in this memory table. Take a look at the function qFreeStmt. Try one of the following to free up a stmt handle:
	;SQL_CLOSE - FREES A SQL CONNECTION
	qFreeStmt(hstmt, 0)

	;or

	;SQL_UNBIND
	qFreeStmt(hstmt, 2)

Article ID:   W12535
Filename:   Invalid Cursor State Error.txt
File Created: 2017:07:28:12:58:32
Last Updated: 1999:04:15:15:47:54