Invalid cursor state

Invalid cursor state

Post by Dmitri Iva » Wed, 25 Jun 2003 15:56:22


Hello Andrew,


AC> I create an SQL "select" query with the sequence:
AC> SQLAllocHandle()
AC> SQLPrepare()
AC> SQLBindCol()
AC> SQLExecute()
AC> SQLFetch()

Add SQLCloseCursor() before the second SQLExecute().

AC> I then perform the query again with:
AC> SQLExecute()
AC> SQLFetch()
AC>
AC> however, on the second and subsequent calls SQLExecute() returns
AC> 0XFFFF and SQLGetDiagRec() indicates "Invalid cursor state",
AC> presumably because the cursor is positioned after the last record.
AC>
AC> Do I have to reconstruct the whole query each time? Or is there
AC> some quicker call that restores the cursor to the beginning of the
AC> recordset?
 
 
 

Invalid cursor state

Post by rlfin » Thu, 26 Jun 2003 12:38:11

Andrew

it is not necessary to reconstruct everything - the only requirement is that, after you have fetched all of the data from the
cursor, you must explicitly call SQLCloseCursor before each subsequent call to SQLExecute.

regards
roy fine