Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SMS AddAttachment Protocol Error Classic ASP 10 36
SP to delete duplicates 15 61
Select distinct 25 83
CDO.Message not able to send attachement 5 12
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
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/…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

910 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

23 Experts available now in Live!

Get 1:1 Help Now