Link to home
Start Free TrialLog in
Avatar of robrodp
robrodpFlag for Mexico

asked on

ms sql 2005 asp script error closed recordset

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

ASKER CERTIFIED SOLUTION
Avatar of BrandonGalderisi
BrandonGalderisi
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of robrodp

ASKER

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
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.