Start New Discussion Reply to this Discussion ADODB.Recordset error '800a0e78' Operation is not allowed when the object is closed.
Hello,
I am getting the error:
ADODB.Recordset error '800a0e78' Operation is not allowed when the object is closed.
regarding the line below stating: "Do Until intX = 1 Or GEMCCdb.EOF"
<%
strPwd = Request.Form("pwd")
strUsr = Request.Form("usr")
Set GEMCCdb=Server.CreateObject("ADODB.recordset")
GEMCCdb.open "TABLE", "DSN=DBNAME;uid=USERNAME;pwd=PASSWORD",2,3
GEMCCdb.MoveFirst
Do Until intX = 1 Or GEMCCdb.EOF
If GEMCCdb("email") = strUsr Then
intX = 1
If GEMCCdb("str3") = True Then
Response.Redirect("login.asp?x=3")
Else
If GEMCCdb("password") = strPwd Then
GEMCCdb("str1") = False
GEMCCdb("str2") = False
GEMCCdb("str3") = False
%>
<form name="login" action="clientele.aspx" method="post" target="_parent">
<input type="hidden" name="id" value="<%=GEMCCdb("id")%>" />
<input type="hidden" name="email" value="<%=GEMCCdb("email")%>" />
<input type="hidden" name="first" value="<%=GEMCCdb("first")%>" />
<input type="hidden" name="full" value="<%=GEMCCdb("first") & " " & GEMCCdb("last")%>" />
<input type="hidden" name="last" value="<%=GEMCCdb("last")%>" />
<input type="hidden" name="password" value="<%=GEMCCdb("password")%>" />
<input type="hidden" name="random" value="<%=GEMCCdb("random")%>" />
<input type="hidden" name="login" value="1" />
</form>
<%
GEMCCdb.Update
GEMCCdb.Close
%>
<script language="javascript" type="text/javascript">
document.login.submit();
</script>
<%
Else
If GEMCCdb("str1") = False Then
GEMCCdb("str1") = True
ElseIf GEMCCdb("str2") = False Then
GEMCCdb("str2") = True
Else
If GEMCCdb("str3") = False Then
GEMCCdb("str3") = True
End If
Response.Redirect("login.asp?x=3")
End If
GEMCCdb.Update
GEMCCdb.Close
Response.Redirect("login.asp?x=x")
End If
End If
Else
GEMCCdb.MoveNext
End If
Loop
%>
Any help is greatly appreciated. Thank you!
gemccllc
Newbie Poster
1 post since Mar 2012
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
GEMCCdb.Update
GEMCCdb.Close
when you update and close the record set, it is still going to finish the current loop iteration, and when it comes to check the condition to loop again, your loop checks if GEMCCdb.EOF and when GEMCCdb is closed that is impossible to do.
anyways, ANYTIME you get to GEMCCdb.close, you ALREADY have gone over intX = 1 so the condition is already gonna be over, now im guessing you have this condition there in case the rs is initialy empty, simply take the GEMCCdb.EOF outside of the do while condition and set up an if before it even starts.
...
GEMCCdb.MoveFirst
If GEMCCdb.EOF Then
intX = 1
End If
Do Until intX = 1
...
Philippe.Lahaie
Posting Whiz
360 posts since Oct 2007
Reputation Points: 103
Solved Threads: 54
Skill Endorsements: 4
Above info is correct but to simplify it:
GEMCCdb.Close should only appear once after Loop
vsmash
Junior Poster
125 posts since Feb 2010
Reputation Points: 9
Solved Threads: 17
Skill Endorsements: 0
© 2013 DaniWeb® LLC
Page generated in 0.0748 seconds
using 2.79MB