%@ LANGUAGE="VBSCRIPT" %>
<% Option Explicit %>
<% If Session("ValidatedAdministrator") <> True Then
Response.Redirect "error.asp?error=denied"
End If %>
Administer Visual Basic Student Accounts
<%
Dim objRS
Dim sSQL
Dim i
Dim strTmp
Dim bAdmin
'Admin can see ALL student records, Teachers only see their student's records and their own
If Session("Admin") = "Admin" Then
sSQL = "SELECT * FROM Students ORDER BY security, name;"
bAdmin = True
Else
sSQL = "SELECT * FROM Students WHERE teacher = '" & Session("admin") & "' ORDER BY security, classtype, meetday, name;"
bAdmin = False
End If
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open sSQL, objConn, adOpenDynamic, adLockOptimistic, adCmdText
'Don't try displaying non-existent records
If Not (objRS.EOF And objRS.BOF) Then
objRS.MoveFirst
%>
VB Student List - <%=Session("admin")%>
<%
Else
' No Records Message
Response.Write("No Records Found!
")
End If
objRS.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
%>