PDA

View Full Version : asp or sql error help appreciated


commandprompt
06-24-2006, 03:41 PM
This is the error message i get;

Microsoft VBScript runtime error '800a01a8'

Object required: ''

/admin/logon_process.asp, line 9

this is the code; (I just cannot see it?) line 9 is in red!

<%@ Language=VBScript %>
<%
Dim str_conx, conx, LogonRs
set conx=Server.CreateObject("adodb.connection")

conx.Provider="Microsoft.JET.OLEDB.4.0"
conx.Open("d:\hosting\abrewitt\access_db\blogdb.mdb")

LogonRs.Open "SELECT * from logon WHERE user_name='" & _
request("txtname") & "'" & " AND user_password='" & _
request("txtnassword") & "'",conx,adOpenKeyset,adLockOptimistic

If LogonRs.RecordCount=1 Then ' user has been validated...
' set session variable to be true (true for time user is logged in)
session("loggedin") = TRUE
session("usr_accesslevel") = LogonRs("user_access")
session("usr_name") = LogonRs("user_fullname")
session("usr_initials") = LogonRs("user_initials")
Else
' maintain "false" status
session("loggedin")=FALSE

' inform user that attempt has been unsuccessful
Response.Redirect("logonfail.asp")
End If
Response.Redirect("default.asp")
%>

RickPlmr
08-25-2006, 02:10 AM
The LogonRS object has not been instantiated (created) prior to its being referenced on that line in red. Try this - note the new line in bold:

Dim str_conx, conx, LogonRs
set conx=Server.CreateObject("adodb.connection")

conx.Provider="Microsoft.JET.OLEDB.4.0"
conx.Open("d:\hosting\abrewitt\access_db\blogdb.mdb")

Set LogonRs = Server.CreateObject("ADODB.Recordset")

LogonRs.Open "SELECT * from logon WHERE user_name='" & _
request("txtname") & "'" & " AND user_password='" & _
request("txtnassword") & "'",conx,adOpenKeyset,adLockOptimistic

Hope that helps!

thrive
08-26-2006, 01:42 PM
You're also leaving your connection open, and in classic asp the server will not tidy this up.


conx.close
logonrs.close

zkiller
10-17-2006, 02:48 PM
<%@ Language=VBScript %>
<%
Dim str_conx, conx, LogonRs

Set conx= Server.CreateObject("ADODB.Connection")
conx.open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("d:\hosting\abrewitt\access_db\blogdb.mdb"))

Set LogonRs = conx.Open("SELECT * from logon WHERE user_name='" & _
request("txtname") & "' AND user_password='" & _
request("txtnassword") & "'")

If LogonRs.RecordCount=1 Then ' user has been validated...
' set session variable to be true (true for time user is logged in)
session("loggedin") = TRUE
session("usr_accesslevel") = LogonRs("user_access")
session("usr_name") = LogonRs("user_fullname")
session("usr_initials") = LogonRs("user_initials")
Else
' maintain "false" status
session("loggedin")=FALSE

' inform user that attempt has been unsuccessful
Response.Redirect("logonfail.asp")
End If
Response.Redirect("default.asp")
%>
you got your recordset mixed up with your connection object.