Network examination Room (8) (turn) taddstudent.asp

Source: Internet
Author: User
Tags dsn join visual studio
Network <%@ language=vbscript%>
<HTML>
<HEAD>
<meta name= "generator" content= "Microsoft Visual Studio 6.0" >
</HEAD>
<BODY>
<%
If Request.ServerVariables ("http_method") = "POST" and Request.Form ("Submit") <> "skip to" then
' If you submit the form content by post
Set Conn=server. CreateObject ("Adodb.connection")
Conn. Connectionstring= "Dsn=testsys"
Conn. Open
Strstid=request.form ("Stid")
Strstname=request.form ("Stname")
If Request.Form ("submit") = "Join" Then
' If a request to join student information is performed
Strsql= "SELECT * from Studentinfo where stid= '" & Strstid & "'"
' Studentinfo the student's record in the table of the database according to the student number to be added
Set Mrs1=conn. Execute (strSQL)
If not (mrs1. BOF and Mrs1. EOF) Then
' If the student number you want to join already exists, you are prompted to re-enter the information
Response.Write "The school number already exists, please re-enter the student information <br>"
Response.Write "<a href=taddstudent.asp?page=" & Request ("page") & "&stname=" & Strstname & " &stid= "& Strstid &" > Return </a> "
Else
' If the student number you want to join does not exist, add the student information to the database
Strsql= "INSERT into Studentinfo (Stname,stid) VALUES (' & Strstname &" ', ' "& Strstid &") "
Conn. Execute (strSQL)
Strstid= ""
Strstname= ""
End If
End If
If Request.Form ("submit") = "Delete" Then
' If it is to delete the student information request
Strsql= "Delete * from Studentinfo where stid= '" & Strstid & "'"
' Delete Student information
Conn. Execute (strSQL)
' Delete the students ' test scores
Strsql= "Delete * from score where stid= '" & Strstid & "'"
Conn. Execute (strSQL)
Strstid= ""
Strstname= ""
End If
Conn. Close
Set conn=nothing
Else
Strstname=request.querystring ("Stname")
Strstid=request.querystring ("Stid")
End If
%>
<form action= "taddstudent.asp" Method=post id=form1 name=form1>
<p><font face= "Young Circle" size=3 color=crimson> Student Information </FONT><BR>
<font face= "" Size=3> Name:
<input id=stname Name=stname value=<%=strstname%>></font><br>
<font face= "" Size=3> School Number:
<input Id=stid Name=stid value=<%=strstid%>></font>
<font face= "" size=3>
<input id=submit1 name=submit type=submit value= Join >
<input id=submit2 name=submit type=submit value= Delete >
</font></p><font face= "" size=3>
<HR>
</FONT>
<P>
<table border=0 cellpadding=1 cellspacing=1 width=75%>
<tr bgcolor=honeydew>
<TD> name </TD>
<TD> School Number </TD></TR>
<%
Set Mrs=server. CreateObject ("Adodb.recordset")
Mrs. activeconnection= "Dsn=testsys"
Mrs. Source= "Select



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.