robrodp
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?
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
ASKER