?
Solved

ms sql 2005 asp script error closed recordset

Posted on 2009-02-22
3
Medium Priority
?
199 Views
Last Modified: 2012-05-06
th script below runs ok. It runs periodically.

Sometimes on the line
if not EmailRS.eof then
I get an error: operation not available with object closed.
akes it to that
My script (supposedly) opens the record set and if it fails to open  exits the loop not reaching the if not EmailRS.eof thenoffending  line.

The logic of the code (supposedly) that line only if the recorset if open.

Any ideas?
do while true
Set EmailRS = Server.CreateObject("ADODB.RecordSet")
sql="select top 1 * from servicio_proyecto where  ok=0 and initiate=1  order by project desc,id"
on error resume next
EmailRS.Open sql, cn
if Err.Number>0 then
on error goto 0
exit do
end if
on error goto 0
if not EmailRS.eof then
end if
loop

Open in new window

0
Comment
Question by:robrodp
  • 2
3 Comments
 
LVL 39

Accepted Solution

by:
BrandonGalderisi earned 2000 total points
ID: 23705806
Obviously error.number>0 is NOT working.  I've commented that out and placed a wscript.echo in to put the value of err.number to screen.  
do while true
Set EmailRS = Server.CreateObject("ADODB.RecordSet")
sql="select top 1 * from servicio_proyecto where  ok=0 and initiate=1  order by project desc,id"
'on error resume next
EmailRS.Open sql, cn
wscript.echo "ERR=" & err.Number & "=END ERROR<br/>"
if Err.Number>0 then
on error goto 0
exit do
end if
on error goto 0
if not EmailRS.eof then
end if
loop

Open in new window

0
 

Author Comment

by:robrodp
ID: 23705903
After your comment I checked and found there was no close for the EmailRS. I have included the close and will see if it solves the problem
0
 
LVL 39

Expert Comment

by:BrandonGalderisi
ID: 23706954
The error "operation not available with object closed" indicates that the object is not OPEN, not that you didn't CLOSE it.  Some sort of error is happening on line 5 of your code when attempting to open the connection.  Commenting out the "on error resume next" will tell you what.
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question