By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,162 Members | 1,038 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,162 IT Pros & Developers. It's quick & easy.

Error:Operation is not allowed when the object is closed.

P: 1
I am working in classic asp with vbscript.
I am looking for a solution for an error for long time.So i ll post my query.
In my ASP page , I am populating a record set from SQL SERVER stored procedure.
As soon as the record set is populating , i am checking whether it is null or not.
For that , I added


If (RSDataset.EOF) Then
Response.Write("RecordSet in empty")
Else
Response.Write("Record(s) are in the RecordSet")
End If
Response.End

When the stored procedure returning data it display 'Record(s) are in the RecordSet'.
When the stored procedure not returning data(ie no rows) it display 'RecordSet in empty'


But for some cases it is displaying the error


ADODB.Recordset error '800a0e78'

Operation is not allowed when the object is closed.

DataCheckPage.asp, line 35

By googling I came to no that , adding SET NO COUNT ON is a solution.That I already added.
And the Connection is not closed at any stage, as I checked that also.

Can anyone help me out to resolve this ?
Nov 4 '11 #1
Share this Question
Share on Google+
1 Reply


jhardman
Expert 2.5K+
P: 3,405
Which line is giving the error? Is it the rs.eof?

It sounds like you missed a step filling your recordset. The basic procedure I use is
1- initialize your connection object
2- open the connection
3- initialize the recordset
4- fill the recordset
It's been a while since I wrote one from scratch, but it looks something like this:
Expand|Select|Wrap|Line Numbers
  1. set objconn = server.createobject("adodb.connection")
  2. Objconn.open connectionstring
  3. Set objrs = server.createobject("adodb.recordset")
  4. Objrs.open objconn querystring
let me know if this helps.

Jared
Nov 4 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.