Forum Moderators: open
<%
Option Explicit
Dim stu_id
stu_id=request.form("student_id")
Dim oConn, sConnString,sql
Set oConn = Server.CreateObject("ADODB.Connection")
sConnString = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("/_private/marks.mdb") & ";"
oConn.Open(sConnString)
sql = "SELECT * FROM marks WHERE id=" & stu_id &""
Dim results
set results=oConn.Execute(sql)
Response.Write "<table>"
Response.Write "<tr>"
Response.Write "<td>ID</td>"
Response.Write "<td>stu_id</td>"
Response.Write "<td>Course Number</td>"
Response.Write "<td>Course Title</td>"
Response.Write "<td>Grades</td>"
Response.Write "</tr>"
set results=oConn.Execute(sql)
If not Results.EOF then
Response.Write "<tr>"
Response.Write "<td>" & Results("ID") & "</td>"
Response.Write "<td>" & Results("stu_id") & "</td>"
Response.Write "<td>" & Results("course_number") & "</td>"
Response.Write "<td>" & Results("course_title") & "</td>"
Response.Write "<td>" & Results("grades") & "</td>"
Response.Write "</tr>"
'Use the loop if you will be retreiving multiple records.
'Do WHile Not Results.EOF
' Response.Write "<tr>"
' Response.Write "<td>" & Results("ID") & "</td>"
' Response.Write "<td>" & Results("stu_id") & "</td>"
' Response.Write "<td>" & Results("course_number") & "</td>"
' Response.Write "<td>" & Results("course_title") & "</td>"
' Response.Write "<td>" & Results("grades") & "</td>"
' Response.Write "</tr>"
' Results.MoveNext
'Loop
Else
Response.Write "<tr>"
Response.Write "<td colspan=5>No records found..</td>"
Response.Write "</tr>"
End If
Response.Write "</table>
%>
Once that's done, rerun your script and you will receive the error on what's happening.
<added>LOL, looks like miedmark and I posted at the same time!</added>
<added again>After looking at the code, find this line:
sql = "SELECT * FROM marks WHERE id=" & stu_id &""
I notice that you have an extra double quote at the end. Actually, with stu_id, you shouldn't need the last part: &"".
</added again>
You know what a cool feature would be on ww (or any other forum) - while you're posting a reply it should check if the thread has changed since you started typing - like this:
This thread has changed since you clicked reply (would you like to view?). It would give you an option to modify your post before posting.
Just an idea.