Solved

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

Posted on 2004-09-24
5
2,926 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now