Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2004-09-24
5
Medium Priority
?
2,935 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 1000 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
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…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…

772 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