Solved

ADODB.Connection error '800a0e78' Operation is not allowed when the object is closed.

Posted on 2004-09-24
5
2,929 Views
Last Modified: 2008-01-09
still new to the language, trying to do a login page:

<%
      Dim oConn, Notice, Header, Login, LoginUpdate, Thread, Onspec, PreOrder

      Set oConn = Server.CreateObject("ADODB.Connection")
      Set Login = Server.CreateObject("ADODB.Connection")
      oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("core/core.mdb")

      SESSION("cn") = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("core/core.mdb") & ";Persist Security Info=False"

      ip = Request.ServerVariables("REMOTE_ADDR")
      
If not Request.Form("txtEmail") = "" and not Request.form("txtPassword") = "" then
  If Login.EOF Then <---------------------------------Line 143 ERROR!!!
      response.Write("<br><font=verdana size=3><b>Email Address Not Found</b></font>")
  else
      If Request.Form("txtPassword") <> Login.Fields("Pass").Value then
        response.Write("<br><font=verdana size=3><b>Incorrect Password</b></font>")      
      else
        If Login.fields("Admin") = true then
            Stuff
                  
            LoginUpdate="UPDATE cust SET ip ='" & ip & "', dateadded ='" & FormatDateTime(Date, 2) & "' WHERE ID =" & Session("AdminID") & ""
            oConn.Execute LoginUpdate
        else
            More Stuff
                  
            LoginUpdate="UPDATE cust SET ip ='" & ip & "', dateadded ='" & FormatDateTime(Date, 2) & "' WHERE ID =" & Session("CustID") & ""
            oConn.Execute LoginUpdate
        end if
      end if
      Login.Close
      set Login = nothing
  end if
end if
%>
0
Comment
Question by:webber4
  • 3
5 Comments
 
LVL 31

Accepted Solution

by:
alorentz earned 250 total points
ID: 12144046
Ummm, this should be a recordset:

Set Login = Server.CreateObject("ADODB.Recordset")

AND, you never even open the recordset, so you can't have EOF???  Are you new to ASP?
0
 
LVL 31

Expert Comment

by:alorentz
ID: 12144084
Woudl nee to do something like this:

<%
     Dim oConn, Notice, Header, Login, LoginUpdate, Thread, Onspec, PreOrder

     Set oConn = Server.CreateObject("ADODB.Connection")
     Set Login = Server.CreateObject("ADODB.Connection")
     oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("core/core.mdb")

     SESSION("cn") = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("core/core.mdb") & ";Persist Security Info=False"

     ip = Request.ServerVariables("REMOTE_ADDR")
     
If not Request.Form("txtEmail") = "" and not Request.form("txtPassword") = "" then
   SQL = "SELECT * FROM YOURTABLE WHERE EmailAddress ='" & Request.Form("txtEmail")  & "' and Pass = '" & Request.Form("txtPassword")  & "'"
    login.open sql, oConn, 2, 3
  If Login.EOF Then <---------------------------------Line 143 ERROR!!!
     response.Write("<br><font=verdana size=3><b>Email Address Not Found</b></font>")
  else
     If Request.Form("txtPassword") <> Login.Fields("Pass").Value then
       response.Write("<br><font=verdana size=3><b>Incorrect Password</b></font>")    
     else
       If Login.fields("Admin") = true then
          Stuff
               
          LoginUpdate="UPDATE cust SET ip ='" & ip & "', dateadded ='" & FormatDateTime(Date, 2) & "' WHERE ID =" & Session("AdminID") & ""
          oConn.Execute LoginUpdate
       else
          More Stuff
               
          LoginUpdate="UPDATE cust SET ip ='" & ip & "', dateadded ='" & FormatDateTime(Date, 2) & "' WHERE ID =" & Session("CustID") & ""
          oConn.Execute LoginUpdate
       end if
     end if
     Login.Close
     set Login = nothing
  end if
end if
%>
0
 
LVL 31

Expert Comment

by:alorentz
ID: 12144105
Also, you can do not equal like this: <>

If Request.Form("txtEmail") <> "" and Request.form("txtPassword") <> "" then
   SQL = "SELECT * FROM YOURTABLE WHERE EmailAddress ='" & Request.Form("txtEmail")  & "' and Pass = '" & Request.Form("txtPassword")  & "'"
    LOGIN.open sql, oConn, 2, 3
   ....
0
 
LVL 8

Expert Comment

by:a_twixt_in_the_tale
ID: 12144369
In case, you want ready-made login code
  http://www.planet-source-code.com/vb/scripts/ShowCode.asp?lngWId=4&txtCodeId=6446

But then its always better to try making your own :)

:)
Don

0
 

Expert Comment

by:sreekanth_k77
ID: 12345901
yes Login should be recordset

like:

set login = server.createObject("ADODB.RecordSet")
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

828 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