Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Aug 2005
    Location
    Laguna, Philippines
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts

    help.... Microsoft VBScript runtime (0x800A01A8) Object Required "

    I really dont know what's the problem here, please help me... here's the code
    <%
    dim clientcode, username, password, password2, pass
    clientcode=trim(request.form("clientcode"))
    username=trim(request.form("username"))
    password=trim(request.form("password"))
    password2=trim(request.form("password2"))

    if clientcode<>"" then
    if username<>"" then
    if password<>"" then
    if password2<>"" then

    if password=password2 then
    set cone=server.createobject("adodb.connection")
    sConnString = "PROVIDER=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("purchase.mdb")
    cone.open sConnString
    set vanny=server.createobject("adodb.recordset")
    sql="select * from purchase where username ='" & username & "' and clientcode=" & clientcode
    vanny.open sql, cone

    if vanny.eof then
    response.write "<center>" &"<font color=red>" &"<b>" &"Client Code and User Name doesn't

    exist." &"</b>" &"</font>" &"</center><br>"
    response.write "<center>" &"<font color=red>" &"<b>" &"Please make sure you enter the

    correct information" &"</b>" &"</font>" &"</center>"
    else
    pass = vanny.fields("password")
    if pass = password then
    vanny.close
    cone.close
    response.redirect("http://localhost/blueskies/orderform.asp")
    else
    response.write "<center>" &"<font color=red>" &"<b>" &"Incorrect password..."&"</

    b>" &"</font>" &"</center>"
    end if
    end if

    else
    response.write "<center>" &"<font color=red>" &"<b>" &"Password mismatch..."&"</b>" &"</

    font>" &"</center>"
    end if
    else
    response.write "<center>" &"<font color=red>" &"<b>" &"Please retype your Password"&"</b>" &"</

    font>" &"</center>"
    end if
    else
    response.write "<center>" &"<font color=red>" &"<b>" &"Please provide your Password"&"</b>" &"</font>" &"

    </center>"
    end if
    else
    response.write "<center>" &"<font color=red>" &"<b>" &"Please provide your User Name"&"</b>" &"</font>" &"</

    center>"
    end if
    else
    response.write "<center>" &"<font color=red>" &"<b>" &"Please provide your Client Code"&"</b>" &"</font>" &"</center>"
    end if

    vanny.close <----------the error points here
    cone.close
    %>
    "It is the unknown we fear when we look upon death and darkness, nothing more!"-- Albus Dumbledore

  • #2
    Senior Coder
    Join Date
    Dec 2002
    Location
    Arlington, Texas USA
    Posts
    1,072
    Thanks
    4
    Thanked 8 Times in 8 Posts
    Please use code tags in the future. It makes it much easier to read with them in place.

    You have 5 if statements before you open any objects. If any of these is false then the object is not created therefore it doesn't exist. so you cannot wait until the end of the page to close and release the objects. I have moved the code to the correct location for you. Also remember to release the objects from memory merely closing the objects does not remove the pointer to the memory in the stack.

    Code:
    <%
    if clientcode<>"" then
    	if username<>"" then
    		if password<>"" then
    			if password2<>"" then
    				if password=password2 then
    					set cone=server.createobject("adodb.connection")
    					sConnString = "PROVIDER=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("purchase.mdb")
    					cone.open sConnString 
    					set vanny=server.createobject("adodb.recordset")
    					sql="select * from purchase where username ='" & username & "' and clientcode=" & clientcode 
    					vanny.open sql, cone
    
    					if vanny.eof then
    						response.write "<center>" &"<font color=red>" &"<b>" &"Client Code and User Name doesn't exist." &"</b>" &"</font>" &"</center><br>"
    						response.write "<center>" &"<font color=red>" &"<b>" &"Please make sure you enter the correct information" &"</b>" &"</font>" &"</center>"
    					else
    						pass = vanny.fields("password")
    						if pass = password then
    							vanny.close
    							cone.close
    							response.redirect("http://localhost/blueskies/orderform.asp")
    						else
    							response.write "<center>" &"<font color=red>" &"<b>" &"Incorrect password..."&"</b>" &"</font>" &"</center>"
    						end if
    					end if
    					vanny.close               
                                            Set vanny = Nothing
    					cone.close
    					Set cone = Nothing
    				else
    					response.write "<center>" &"<font color=red>" &"<b>" &"Password mismatch..."&"</b>" &"</font>" &"</center>"
    				end if
    			else
    				response.write "<center>" &"<font color=red>" &"<b>" &"Please retype your Password"&"</b>" &"</font>" &"</center>" 
    			end if
    		else
    			response.write "<center>" &"<font color=red>" &"<b>" &"Please provide your Password"&"</b>" &"</font>" &"</center>" 
    		end if
    	else
    		response.write "<center>" &"<font color=red>" &"<b>" &"Please provide your User Name"&"</b>" &"</font>" &"</center>" 
    	end if
    else
    	response.write "<center>" &"<font color=red>" &"<b>" &"Please provide your Client Code"&"</b>" &"</font>" &"</center>" 
    end if
    %>
    Last edited by miranda; 08-16-2005 at 02:50 AM.

  • #3
    Senior Coder
    Join Date
    Dec 2002
    Location
    Arlington, Texas USA
    Posts
    1,072
    Thanks
    4
    Thanked 8 Times in 8 Posts
    also you would be better off like this

    Code:
    <%
    if clientcode<>"" OR username<>"" OR password<>"" OR password2<>"" OR password <> password2 then
       if clientcode<>"" then response.write "<center>" &"<font color=red>" &"<b>" &"Please provide your Client Code"&"</b>" &"</font>" &"</center>" 
       if username<>"" then response.write "<center>" &"<font color=red>" &"<b>" &"Please provide your User Name"&"</b>" &"</font>" &"</center>" 
       if password<>"" then response.write "<center>" &"<font color=red>" &"<b>" &"Please provide your Password"&"</b>" &"</font>" &"</center>"
       if password2<>"" then response.write "<center>" &"<font color=red>" &"<b>" &"Please retype your Password"&"</b>" &"</font>" &"</center>"
       if password <> password2 then response.write "<center>" &"<font color=red>" &"<b>" &"Password mismatch..."&"</b>" &"</font>" &"</center>"
    else 
        set cone=server.createobject("adodb.connection")
        sConnString = "PROVIDER=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("purchase.mdb")
        cone.open sConnString 
        set vanny=server.createobject("adodb.recordset")
        sql="select * from purchase where username ='" & username & "' and clientcode=" & clientcode 
       vanny.open sql, cone
       if vanny.eof then
             response.write "<center>" &"<font color=red>" &"<b>" &"Client Code and User Name doesn't exist." &"</b>" &"</font>" &"</center><br>"
             response.write "<center>" &"<font color=red>" &"<b>" &"Please make sure you enter the correct information" &"</b>" &"</font>" &"</center>"
       else
             pass = vanny.fields("password")
             if pass = password then
    	    vanny.close 
    	    SET vanny = Nothing
    	    cone.close
    	    Set cone = Nothing			
                 response.redirect("http://localhost/blueskies/orderform.asp")
             else
                 response.write "<center>" &"<font color=red>" &"<b>" &"Incorrect password..."&"</b>" &"</font>" &"</center>"
             end if
        end if
        vanny.close 
        SET vanny = Nothing
        cone.close
        Set cone = Nothing
    End If
    %>

  • #4
    New Coder
    Join Date
    Aug 2005
    Location
    Laguna, Philippines
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts
    tnx a lot, i'll try this out.... God blesses
    "It is the unknown we fear when we look upon death and darkness, nothing more!"-- Albus Dumbledore

  • #5
    New Coder
    Join Date
    Aug 2005
    Location
    Laguna, Philippines
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts
    tnx a million guys.... really....
    "It is the unknown we fear when we look upon death and darkness, nothing more!"-- Albus Dumbledore

  • #6
    New to the CF scene
    Join Date
    May 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Same Problem

    Here is my code:

    <%
    DIM strEmail
    strEmail = Request.Form("email")

    IF strEmail <> "" THEN
    %>
    <%
    DIM sql, rs, Conn

    Set Conn = Server.CreateObject("ADODB.Connection")
    Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
    Server.MapPath ("/swartzjm/datastore/login.mdb") & ";"
    Conn.Open

    sql = "SELECT email, password, username FROM login WHERE email = '" & strEmail & "'"
    Set rs = Server.CreateObject( "ADODB.Recordset" )
    rs.Open sql, Conn

    IF rs.EOF THEN
    Response.Write "That email address was not found in our database."
    Response.Write "<b>Please click Back on your browser and enter the email address you registered with.</b>"
    ELSE
    DIM strPassword, strUsername
    strPassword = rs("password")
    strUsername = rs("username")

    DIM mail, objMail
    Set objMail = Server.CreateObject("CDO.Message")
    objMail.From = "Webmaster@CareersandJobs.com"
    objMail.Subject = "Forgotten Login Information"
    objMail.To = strEmail
    objMail.TextBody = "Here is your login information for the email address of " & strEmail & vbCrLf & _
    "Username: " & strUsername & vbCrLf & _
    "Password: " & strPassword
    objMail.Send
    Set objMail = nothing

    Response.Write "Your password has been sent to your email address." & "<br>"

    Response.Write "<br>" & "<b> Please allow up to 24 hours to recieve your login information. </b>"
    END IF

    ELSE
    Response.Write "Please click Back on your browser and enter the email address you registered with."
    END IF

    Conn.close
    Set Conn = nothing

    rs.close
    Set rs = nothing
    %>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •