Data objects closed error in ADO 2.1 and SQL server 6.5 
Author Message
 Data objects closed error in ADO 2.1 and SQL server 6.5


I am using ADO 2.1 to access the recordset returned by a stored
procedure on SQL server 6.5 and encountered the following error message:

"The operation requested by the application is not allowed if the
object is closed."

The problem only occured after I extended my original stored procedure,
which was a simple select statement (with group by) inside a dynamic
execution.  The extension I needed was to modify some of the data from
that select in order to perform another aggregation (sum).  In short,

Original Stored Procedure:
  Select ... From ... Where ... Group By ...

Extended Stored Procedure:
  (1) Select ... From ... Into #TMP Where ...
  (2) Declare a cursor to go thru the whole of #TMP to extract specific
      data that I needed to update on.
  (3) Close and deallocate the cursor.
  (4) Select ... From #TMP Where ... Group By ...

Both the original stored procedure and the extended one worked
perfectly in iSQL and gave identical results (when the data did not
actually need any modification).  However, accessing the result set
from a DLL (via ADO 2.1) bombed on the extended stored procedure (but
not the original).

From my previous experience with this particular error message, I
suspect that the extended stored procedure is somehow returning
multiple result sets, the first of which is empty and thus considered
closed by ADO.  However, this "phantom" result set is not visible in
the iSQL window and I cannot pinpoint where it could have come from.
Does anyone have any idea what is going on?  Could the "Select ... Into
#TMP ..." somehow is returning an empty result set?

Thanks for any help or advice that you can offer.

Albert Yu

newsgroup, thanks.

Sent via http://www.*-*-*.com/
Share what you know. Learn what you don't.

Mon, 18 Feb 2002 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. ADO 2.1/SQL Server 6.5 - IDENTITY Question

2. ADO 2.1/SQL Server 6.5 - IDENTITY Question

3. ADO data control 6.0 and ADO data object 2.1 conflict

4. OLE object data type in SQL Server 6.5

5. Mass Insert into SQL 6.5 from data in a RecordSet ADO object

6. sql server 6.5 ado error

7. Need to Save .rpt files in SQL Server 7.0 with ADO 2.1

8. ADO 2.1 & SQL Server installed

9. ADO OLEDB SQL Server 6.5

10. Strange Behavior - ADO and SQL Server 6.5

11. ADO 2.0 connection to SQL Server 6.5

12. SQL Server 6.5 & VB6 ADO


Powered by phpBB® Forum Software