|
-
Nov 11th, 2000, 01:57 PM
#1
Thread Starter
Member
Can anyone tell me why my data will not display in the receiving page. Both are an asp page
STUDENTGRADE.asp
<HTML>
<HEAD>
<Title>asp</Title></Head>
<Body>
<%
Dim Conn, RS, SQL, StudentID, Quiz1, Quiz2, Quiz 3, Homework1, Homework2, Homework3, Midterm
Set Conn = server.CreateObject("ADODB.Connection")
Call Conn.Open("Driver={Microsoft Access Driver (*.mdb)}; " & _
"DBQ=a:/CPT375Project/grade.mdb" )
%>
<h3>Scores for AT 308 Fall 2000 Semester</h3>
<p>Enter the right seven characters of your student ID in the form xx-xxxx and press the Refresh button.
For example, if your student ID is 123-45-6789 then enter 45-6789.</p>
<Form method = "post" action="StudentLookup.asp">
<input type = "text" name = "SSN" size = "10" maxlength = "7">
<%
Call Conn.Close
%>
<input type = "Submit" value = "Refresh">
</Form>
</Body>
</HTML>
STUDENTLOOKUP.asp
<HTML>
<HEAD>
<TITLE>Student</Title>
</HEAD>
<Body>
<%
Dim Conn, RS, SQL, StudentID, Quiz1, Quiz2, Quiz 3, Homework1, Homework2, Homework3, Midterm
Set Conn = server.CreateObject("ADODB.Connection")
Call Conn.Open("Driver= {Microsoft Access Driver (*.mdb)}; " & _
"DBQ=a:/CPT375Project/grade.mdb" )
StudentID = Request.Form("SSN")
SQL = "SELECT * FROM Grade WHERE StudentSSN = '" & StudentID & "'"
Set RS = CONN.Execute(SQL)
%>
<h3>Raw scores for Student ID StudentID</h3>
<p>SSN: <% = RS.Fields("StudentSSN").Value %></br>
QUIZ1: <% = RS.Fields("Quiz1").Value %></br>
QUIZ2: <% = RS.Fields("Quiz2").Value %></br>
QUIZ3: <% = RS.Fields("Quiz3").Value %></br>
HOMEWORK1: <% = RS.Fields("Homework1").Value %></br>
HOMEWORK2: <% = RS.Fields("Homework2").Value %></br>
HOMEWORK3: <% = RS.Fields("Homework3").Value %></br>
MIDTERM: <% = RS.Fields("Midterm").Value %></br></p>
<%
Call RS.Close
Call Conn.close
%>
</Body>
</HTML>
Thanks in advance
-
Nov 12th, 2000, 02:31 PM
#2
Frenzied Member
First off, you don't need any of the variables you declare in the 1st page and you don't need to open the connection to the database until you get to page 2.
I would give your form a name.
In page 2:
Code:
<h3>Raw scores for Student ID StudentID</h3>
'should be
<h3>Raw scores for Student ID <%=StudentID%></h3>
Is it possible you need to check the entire SSN and not just the last 7 digits and is it possible that the data is not stored with the '-' characters.
If the StudentSSN field in the database is the full SSN, your recordset will return no data since you are only collecting the last 7 digits from the user on the 1st page.
No need for 'Call Conn.close', 'Conn.close' will suffice.
Otherwise it looks ok to me..
oOOo--oOOo
__ /\/\onte96
oOOo--oOOo
Senior Programmer/Analyst
MCP
[email protected]
[email protected]
Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..
-
Nov 13th, 2000, 05:40 AM
#3
Frenzied Member
if you view-source are there any error messages?
-
Nov 13th, 2000, 06:49 AM
#4
Conquistador
If you are running this on a web server, it would be trying to get the database off the disk on the server...
replace the database source for your own one...
to test go here: http://www13.brinkster.com/dasilvy/help.asp
the test user is 00-0000
they got 100 on everything..
try this code:
STUDENTLOOKUP.ASP
Code:
<%
Dim MyConn, sConnString
Set Myconn = Server.CreateObject("ADODB.Connection")
'You must change the following line:
ConnString = "DRIVER={Microsoft Access Driver (*.mdb)};" & _
"DBQ=" & Server.MapPath("\dasilvy\db\students.mdb") & ";"
MyConn.Open(ConnString)
strsql = "SELECT * FROM Student where SSN = '" & request.form("test") & "'"
response.write strsql
Set rs = Server.CreateObject("ADODB.RecordSet")
RS.open strsql, MyConn, 3, 3
ssn = request.form("test")
quiz1 = rs("quiz1")
quiz2 = rs("quiz2")
quiz3 = rs("quiz3")
homework1 = rs("homework1")
homework2 = rs("homework2")
homework3 = rs("homework3")
midterm = rs("midterm")
%>
<h3>Raw scores for Student ID <%=ssn%></h3>
<p>SSN: <%=ssn%></br>
QUIZ1: <%=quiz1%></br>
QUIZ2: <%=Quiz2%></br>
QUIZ3: <%=Quiz3%></br>
HOMEWORK1: <%=Homework1%></br>
HOMEWORK2: <%=Homework2%></br>
HOMEWORK3: <%=Homework3%></br>
MIDTERM: <%=Midterm%></br></p>
<%
RS.Close
MyConn.close
%>
Previous Page
Code:
<HTML>
<HEAD>
<Title>asp</Title></Head>
<Body>
<h3>Scores for AT 308 Fall 2000 Semester</h3>
<p>Enter the right seven characters of your student ID in the form xx-xxxx and press the Refresh button.
For example, if your student ID is 123-45-6789 then enter 45-6789.</p>
<Form method="post" action="StudentLookup.asp">
<input type="text" name="test" size="10" maxlength="7">
<input type = "Submit" value = "Refresh">
</Form>
</Body>
</HTML>
tell me if this all works for you
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|