...

View Full Version : help.... Microsoft VBScript runtime (0x800A01A8) Object Required "



lovesirius12
08-16-2005, 02:16 AM
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
%>

miranda
08-16-2005, 02:48 AM
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.


<%
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
%>

miranda
08-16-2005, 03:02 AM
also you would be better off like this



<%
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
%>

lovesirius12
08-16-2005, 03:30 AM
tnx a lot, i'll try this out.... God blesses

lovesirius12
08-16-2005, 03:37 AM
tnx a million guys.... really.... :thumbsup:

swartzieee
05-11-2006, 02:53 AM
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
%>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum