var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: 24000 : Invalid cursor state, prepared statement
I have written a routine to search a unique record using prepared statement. Its my first sql coding with c++.
I am not using / importing any dlls.
I connect+allocs handels , then use SQLPrepare(StmtHandle, SQLStmt,SQL_NTS); to generate a guery.
I have written bind parameters and sqlexecute +sqlFetch in a loop and loop gets executed till ESC key is pressed.
First time when I bind paramaters using SQLBindParameter it works perfect.
When loop gets executed secondtime onwards, it gives an error.
Message: [Pervasive][ODBC Client Interface]Invalid cursor state.
If I open connection, handles, and prepared starement in same loop, THEN it gives correct record without 24000 error.
I want the advantage of prepared staement. So I do not want to close and open connection and prepare statement every time.
Have I missed any step?
Where & when I should code the cursor type? Any specific libraries I need to link?
Post your code. Also, what exact version of Pervasive are you using?
Certified Pervasive Developer
Certified Pervasive Technician
Custom Btrieve/VB development
I do not answer questions by email. Please post on the forum.
Thanks for replying.
i found the solution ( mistake in coding).
I feel satisfied for tracing solution and also feel ashamed that I have to test 50-60 times for this.
I was making fundamental miatake, due to less experience with SQL ( and also prepared statement )
the solution is :-
Handle of scrollable cursor need to be closed, beforing, binding new values in prepared statement.
If you have better solution, I am open for all suggestions.