Click to See Complete Forum and Search --> : Need Help with ASP


Redhead
03-05-2003, 01:16 PM
Hi Everyone

I'm trying to learn ASP on my own. I am trying to create a login area where a member can login and it will pull information out of a access97 db about them.

I have the login working well and it does send them to the members page, that's were i'm having troubles.

What i have is

<%
Dim strError
Dim strSQL
Dim rst
Dim conn

set conn = server.CreateObject("ADODB.Connection")

conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:/WebSites/ClientOne/members/mas_2000.mdb"

strSQL = "SELECT rating FROM AllPerProf WHERE studentid='" & _
(Request.Form("studentid")) & "'"

set rst = server.CreateObject("ADODB.Recordset")

rst.Open strSQL, conn

If Not rst.EOF then
Response.write rst("rating")
Else
Response.write "Could not Find Value"
End IF

rst.close
set rst = nothing
set objCommand = Nothing


%>

i'm getting the error
No value given for one or more required parameters.
/ClientOne/members/default.asp, line 16

Can anyone help me! :)

Bullschmidt
03-05-2003, 01:48 PM
Something is wrong here:

strSQL = "SELECT rating FROM AllPerProf WHERE studentid='" & _
(Request.Form("studentid")) & "'"

Maybe studentid is really a number field and doesn't need the extra single quotes around what it is being set to.

Redhead
03-05-2003, 05:12 PM
Hi there

That error was i was looking for a field called studentid and it should have been id so that's fixed.

What my goal is, is to have a student login using the login.asp page check a db called testdb to make sure they are a user if so set session to be

Session("loggedin") = True
Session("userid") = objRS("studentid")

and then open default.asp page in a dir called memebers where it pull info about that studentid out of a db called mas_2000.mdb. The deafult page know read this:

<%
Dim strError
Dim strSQL
Dim rst
Dim conn

If Session("loggedin") = True Then

set conn = server.CreateObject("ADODB.Connection")

conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:/WebSites/ClientOne/members/mas_2000.mdb"


strSQL = "SELECT rating FROM AllPerProf WHERE id='" & _
(Request.Form("studentid")) & "'"

set rst = Server.CreateObject("ADODB.Recordset")

rst.Open strSQL, conn

If Not rst.EOF then
Response.write rst("rating")
Else
Response.write "Could not Find Value"
End IF

rst.close
set rst = nothing
set objCommand = Nothing

End IF

%>

and know i'm getting this error
Data type mismatch in criteria expression.
/ClientOne/members/default.asp, line 22

rst.Open strSQL, conn

any ideas :confused:

Bullschmidt
03-05-2003, 06:42 PM
Maybe id is really a number field in the database instead of a text field and doesn't need the extra single quotes around what it is being set to.