468,514 Members | 1,616 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,514 developers. It's quick & easy.

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

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")
Response.Write("Record(s) are in the RecordSet")
End If

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
1 6102
3,405 Expert 2GB
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.

Nov 4 '11 #2

Post your reply

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

Similar topics

By using this site, you agree to our Privacy Policy and Terms of Use.