CRecordset Error - Connection is busy with results for another hstmt
-
I get the error "Connection is busy with results for another hstmt" when I call the CRecordset::Open on an SQLServer database. The code has been working for several years on WATSQL (now Sybase SQLAnywhere) until I switched the database recently to run on SQLServer. Does anyone have an idea what is going on, or what options I may need to set to get rid of this. For instance, in the code below, line (1.) works without problem, while line (2.) fails giving the error above. Both statements were failing on ::SQLExecute(m_hstmt) inside MFC; 1. if (!m_pAssetSet->Open(CRecordset::snapshot)) DisplayError(); 2. if (!m_pAssetypeSet->Open(CRecordset::snapshot)) DisplayError(); Also, when I switch the code to call Open with default arguments, both Open statements work, but then my Add/Edit/Update on m_pAssetSet fails right in the bowels of MFC with SQLSetPos on line (1.) as follows: ::SQLSetPos(m_hstmt, 1, wPosOption, SQL_LOCK_NO_CHANGE); The second error message is something to the effect that an option is invalid. Does anyone have any idea what is causing this? Why should I be getting this even when I call CRecordset::Open with default arguments. Any suggestions Gaul http://www.gaulles.com
-
I get the error "Connection is busy with results for another hstmt" when I call the CRecordset::Open on an SQLServer database. The code has been working for several years on WATSQL (now Sybase SQLAnywhere) until I switched the database recently to run on SQLServer. Does anyone have an idea what is going on, or what options I may need to set to get rid of this. For instance, in the code below, line (1.) works without problem, while line (2.) fails giving the error above. Both statements were failing on ::SQLExecute(m_hstmt) inside MFC; 1. if (!m_pAssetSet->Open(CRecordset::snapshot)) DisplayError(); 2. if (!m_pAssetypeSet->Open(CRecordset::snapshot)) DisplayError(); Also, when I switch the code to call Open with default arguments, both Open statements work, but then my Add/Edit/Update on m_pAssetSet fails right in the bowels of MFC with SQLSetPos on line (1.) as follows: ::SQLSetPos(m_hstmt, 1, wPosOption, SQL_LOCK_NO_CHANGE); The second error message is something to the effect that an option is invalid. Does anyone have any idea what is causing this? Why should I be getting this even when I call CRecordset::Open with default arguments. Any suggestions Gaul http://www.gaulles.com
First. post your questions in the Question Forum. Second. I have a lot problems with the CRecordset class and needed to migrate my project to the CDaoRecordset class. (with visual C 4.0) Now I wrote my Own class using ADO. Carlos Antollini.