home *** CD-ROM | disk | FTP | other *** search
/ sau9.org / sau9.org.zip / sau9.org / mathapp / student_add.asp < prev    next >
Text File  |  2002-11-20  |  2KB  |  77 lines

  1. <%@ Language=VBScript %>
  2. <%
  3.  Response.Buffer = True
  4.  
  5.  
  6. Function ChkString(string)
  7.   If string = "" Then string = " "
  8.    ChkString = Replace(string, "'", "''")
  9.    End Function
  10.  
  11. response.write "<table> <tr> <Td><Font face=tahoma size=4><h2>New Student Confirmation <br>"
  12.  
  13. response.write "</td><td> <img src=math.gif width=140></td></tr></table>"
  14.  
  15.  
  16.  
  17.  
  18. filePath = Server.MapPath("math_proj.mdb")
  19. Set conn = Server.CreateObject("ADODB.Connection")
  20.  
  21. conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & filePath
  22.  
  23.  
  24.  
  25.     id= ChkString(Request.form("id"))
  26.     fname =ChkString(Request.Form("fname"))
  27.     lname=ChkString(Request.Form("lname"))
  28.     Grade=chkString(Request.Form("grade"))
  29.     password=chkString(Request.Form("password"))
  30.     idTeacher=chkString(Request.Form("idTeacher"))
  31.  
  32.  
  33. 'sql_update="INSERT into tblStudent INNER JOIN tblPerformance ON tblStudent.idStudent = tblPerformance.idStudent (tblStudent.idstudent, tblperformance.idstudent, tblStudent.txtFname, tblStudent.txtLName, tblStudent.txtGrade, tblStudent.pwstudent, tblStudent.teacherid) values ("
  34.  
  35.  
  36.  
  37.  
  38. sql_update = "INSERT into tblStudent (idStudent,txtFName,txtLName, txtGrade, pwStudent, TeacherID) VALUES ("
  39.  
  40. sql_update=sql_update & id
  41. sql_update=sql_update & ", '" & fname & "','"
  42. sql_update=sql_update &  lname & "', "
  43. sql_update=sql_update & grade & ", '"
  44. sql_update=sql_update & password & "',"
  45. sql_update=sql_update & idTeacher & ")"
  46.  
  47.  
  48.  
  49.  
  50. 'response.write sql_update
  51. response.write "<font face=tahoma>"
  52. response.write fname & " " & lname
  53. response.write " has been added to the database." 
  54.  
  55.  
  56.  
  57. conn.Execute (sql_update)
  58. conn.close
  59. Set conn = Server.CreateObject("ADODB.Connection")
  60.  
  61. conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & filePath
  62. sql_update2= "INSERT into tblperformance (idStudent) Values ("
  63. sql_update2=sql_update2 & id & ")"
  64.  
  65. conn.Execute (sql_update2)
  66.    ' Done. Close the connection
  67.  
  68.  
  69.  
  70.  
  71.  
  72.    conn.Close
  73.    Set conn = Nothing
  74.  
  75. %>
  76. <a href=student_admin.asp>Return </a> to view the student list.
  77.