<!--#include file="Admin_CommonCode_SDMS.asp"-->
<%
'**************************************************************
' Software name: PowerEasy SiteWeaver
' Web: http://www.powereasy.net
' Copyright (C) 2005－2009 佛山市动易网络科技有限公司 版权所有
'**************************************************************

Const NeedCheckComeUrl = True   '是否需要检查外部访问

Const PurviewLevel = 2      '0--不检查，1--超级管理员，2--普通管理员
Const PurviewLevel_Channel = 0   '0--不检查，1--频道管理员，2--栏目总编，3--栏目管理员
Const PurviewLevel_Others = "InfoManage"   '其他权限

Dim strStudentNum, strName, strGrade, strClass

strStudentNum = ReplaceBadChar(Trim(Request("StudentNum")))
strName = ReplaceBadChar(Trim(Request("Name")))
strGrade = PE_CLng(Request("Grade"))
strClass = Request("ClassSelect")
strFileName = "Admin_StudentInfoManage.asp?Name=" & strName & "&Grade=" & strGrade & "&ClassSelect=" & strClass
If Action <> "InfoPrint2" Then
    Response.Write "<html><head><title>修改/删除学生信息</title>" & vbCrLf
    Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>" & vbCrLf
    Response.Write "<link href='Admin_Style.css' rel='stylesheet' type='text/css'>" & vbCrLf
    Response.Write "<link href='home.css' rel='stylesheet' type='text/css'>" & vbCrLf
    Response.Write "</head>" & vbCrLf
    Response.Write "<body leftmargin='2' topmargin='0' marginwidth='0' marginheight='0'>" & vbCrLf

    Response.Write "<table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border'>" & vbCrLf
    Call ShowPageTitle("学 生 信 息 管 理", 10301)
    Response.Write "  <tr class='tdbg'>" & vbCrLf
    Response.Write "    <td width='70' height='30'><strong>管理导航：</strong></td>" & vbCrLf
    Response.Write "    <td>" & vbCrLf
    Response.Write "  <a href='Admin_StudentInfoManage.asp'>学生信息管理主界面</a>&nbsp;|&nbsp;<a href='Admin_StudentInfoManage.asp?Action=InfoInput'>录入学生信息</a>&nbsp;|&nbsp;<a href='Admin_StudentInfoManage.asp?Action=InfoQuery'>查询学生信息</a>&nbsp;|&nbsp;<a href='Admin_StudentInfoManage.asp?Action=InfoModifyDel'>修改/删除学生信息</a>&nbsp;|&nbsp;<a href='Admin_StudentInfoManage.asp?Action=InfoPrint'>打印学生信息</a>&nbsp;|&nbsp;<a href='Admin_StudentInfoManage.asp?Action=ClassManage'>班级管理</a>&nbsp;|&nbsp;<a href='Admin_StudentInfoManage.asp?Action=GradeManage'>年级管理</a>" & vbCrLf
    Response.Write "    </td>" & vbCrLf
    Response.Write "  </tr>" & vbCrLf
    Response.Write "</table>" & vbCrLf
End If
Select Case Action
Case "InfoInput"
    Call InfoInput
Case "SaveAdd"
    Call SaveAdd
Case "InfoQuery"
    Call InfoQuery
Case "InfoQueryResult"
    Call InfoQueryResult
Case "InfoModifyDel"
    Call InfoModifyDel
Case "InfoModifyList"
    Call InfoModifyList
Case "Modify"
    Call ModifyInfo
Case "SaveModify"
    Call SaveModify
Case "Del"
    Call DelInfo
Case "BatchDel"
    Call BatchDelInfo
Case "InfoPrint"
    Call InfoPrint
Case "InfoPrint2"
    Call InfoPrint2
Case "PrintGuide"
    Call PrintGuide
Case "ClassManage"
    Call ClassManage
Case "SaveClass"
    Call SaveClass
Case "SaveModifyClass"
    Call SaveModifyClass
Case "ModifyClass"
    Call ModifyClass
Case "DelClass"
    Call DelClass
Case "OrderClass"
    Call OrderClass
Case "GradeManage"
    Call GradeManage
Case "SaveGrade"
    Call SaveGrade
Case "SaveModifyGrade"
    Call SaveModifyGrade
Case "ModifyGrade"
    Call ModifyGrade
Case "DelGrade"
    Call DelGrade
Case "OrderGrade"
    Call OrderGrade
Case "DisabledGrade"
    Call DisabledGrade(0)
Case "UnDisabledGrade"
    Call DisabledGrade(1)
Case "UpdateGrade"
    Call UpdateGrade
Case "DoUpdateGrade"
    Call DoUpdateGrade
Case Else
    Call main
End Select

If FoundErr = True Then
    Call WriteErrMsg(ErrMsg, ComeUrl)
End If

Response.Write "</body></html>"
Call CloseSdmsConn
Call CloseConn


Sub main()
    Response.Write "<table width='100%' border='0' align='center' cellpadding='0' cellspacing='0'>" & vbCrLf
    Response.Write "  <tr> " & vbCrLf
    Response.Write "   " & vbCrLf
    Response.Write "    <td width='771' valign='top'>" & vbCrLf
    Response.Write "     <table width='100%' border='0' cellspacing='8' cellpadding='0'>" & vbCrLf
    Response.Write "        <tr> " & vbCrLf
    Response.Write "          <td> <p><br>" & vbCrLf
    Response.Write "              &nbsp;&nbsp;&nbsp;&nbsp;本模块主要是对学生信息（如学号、姓名、性别、家庭住址等）进行管理。本模块又分为<a href='Admin_StudentInfoManage.asp?Action=InfoInput'>录入学生信息</a>、<a href='Admin_StudentInfoManage.asp?Action=InfoQuery'>查询学生信息</a>、<a href='Admin_StudentInfoManage.asp?Action=InfoModifyDel'>修改/删除</a><a href='Admin_StudentInfoManage.asp?Action=InfoPrint'>学生信息、打印学生信息</a>、<a href='ClassManage.asp'>班级管理</a>和<a href='Admin_StudentInfoManage.asp?Action=GradeManage'>" & vbCrLf
    Response.Write "年级管理</a>五个子模块： " & vbCrLf
    Response.Write "            </p>" & vbCrLf
    Response.Write "            <table width='100%' border='0' cellspacing='0' cellpadding='0'>" & vbCrLf
    Response.Write "              <tr align='center'> " & vbCrLf
    Response.Write "                <td><a href='Admin_StudentInfoManage.asp?Action=InfoInput'><img src='images/InfoInput_A.JPG' width='150' height='113' border='0' onMouseOver=""this.src='images/InfoInput_B.jpg';"" onMouseOut=""this.src='images/InfoInput_A.jpg';""><br>" & vbCrLf
    Response.Write "                  录入学生信息</a></td>" & vbCrLf
    Response.Write "                <td><a href='Admin_StudentInfoManage.asp?Action=InfoQuery'><img src='images/InfoQuery_A.JPG' width='150' height='113' border='0' onMouseOver=""this.src='images/InfoQuery_B.jpg';"" onMouseOut=""this.src='images/InfoQuery_A.jpg';""><br>" & vbCrLf
    Response.Write "                  查询学生信息</a></td>" & vbCrLf
    Response.Write "                <td><a href='Admin_StudentInfoManage.asp?Action=InfoModifyDel'><img src='images/InfoModifyDel_A.JPG' width='150' height='113' border='0' onMouseOver=""this.src='images/InfoModifyDel_B.jpg';"" onMouseOut=""this.src='images/InfoModifyDel_A.jpg';""><br>" & vbCrLf
    Response.Write "                  修改/删除学生信息</a></td>" & vbCrLf
    Response.Write "              </tr>" & vbCrLf
    Response.Write "              <tr align='center'> " & vbCrLf
    Response.Write "                <td height='25'>&nbsp;</td>" & vbCrLf
    Response.Write "                <td height='25'>&nbsp;</td>" & vbCrLf
    Response.Write "                <td>&nbsp;</td>" & vbCrLf
    Response.Write "              </tr>" & vbCrLf
    Response.Write "              <tr> " & vbCrLf
    Response.Write "                <td align='center'><a href='Admin_StudentInfoManage.asp?Action=InfoPrint'><img src='images/InfoPrint_A.JPG' width='150' height='113' border='0' onMouseOver=""this.src='images/InfoPrint_B.jpg';"" onMouseOut=""this.src='images/InfoPrint_A.jpg';""><br>" & vbCrLf
    Response.Write "                  打印学生信息</a></td>" & vbCrLf
    Response.Write "                <td align='center'><a href='Admin_StudentInfoManage.asp?Action=ClassManage'><img src='images/ClassManage_A.JPG' width='150' height='113' border='0' onMouseOver=""this.src='images/ClassManage_B.jpg';"" onMouseOut=""this.src='images/ClassManage_A.jpg';""><br>" & vbCrLf
    Response.Write "                  班级管理</a></td>" & vbCrLf
    Response.Write "                <td align='center'><a href='Admin_StudentInfoManage.asp?Action=GradeManage'><img src='images/GradeManage_A.jpg' width='150' height='113' border='0' onMouseOver=""this.src='images/GradeManage_B.JPG';"" onMouseOut=""this.src='images/GradeManage_A.jpg';""><br> " & vbCrLf
    Response.Write "                  年级管理</a></td>" & vbCrLf
    Response.Write "              </tr>" & vbCrLf
    Response.Write "            </table>" & vbCrLf
    Response.Write "            <ul>" & vbCrLf
    Response.Write "              <li><a href='Admin_StudentInfoManage.asp'>录入学生信息模块：</a><br>" & vbCrLf
    Response.Write "                &nbsp;&nbsp;&nbsp;&nbsp;录入学生的学号、姓名、性别、民族、籍贯、出生日期、联系电话、家庭地址和家长姓名等信息。<br>" & vbCrLf
    Response.Write "                &nbsp;&nbsp;&nbsp;&nbsp;录入第一条记录后，系统会自动进入下一学号的录入页面（学号自动加一），减轻了手工劳动并避免了许多错误的发生。<br>" & vbCrLf
    Response.Write "                &nbsp;&nbsp;&nbsp;&nbsp;若录入的学号或自动加一生成的学号与数据库中的记录重复，则会自动转入修改页面。修改完成后同样也会自动进入下一学号录入页面。<br>" & vbCrLf
    Response.Write "                &nbsp;&nbsp;&nbsp;&nbsp;此模块必须先登录后才能使用。 </li>" & vbCrLf
    Response.Write "              <br>" & vbCrLf
    Response.Write "              <br>" & vbCrLf
    Response.Write "              <li><a href='InfoQuery.asp'>查询学生信息模块：</a><br>" & vbCrLf
    Response.Write "                &nbsp;&nbsp;&nbsp;&nbsp;可从学号、姓名或班级三种查询方法任选其一进行查询学生信息。<br>" & vbCrLf
    Response.Write "                &nbsp;&nbsp;&nbsp;&nbsp;支持模糊查询！<br>" & vbCrLf
    Response.Write "                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;例如：<br>" & vbCrLf
    Response.Write "                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;在学号查询框中输入2001，则查询结果为学号中包含“2001”的学生；<br>" & vbCrLf
    Response.Write "                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;在姓名中输入“小”，则查询结果为姓名中包含有“小”的学生； " & vbCrLf
    Response.Write "                <br>" & vbCrLf
    Response.Write "                &nbsp;&nbsp;&nbsp;&nbsp;此模块必须先登录后才能使用。 </li>" & vbCrLf
    Response.Write "              <br>" & vbCrLf
    Response.Write "              <br>" & vbCrLf
    Response.Write "              <li><a href='InfoModifyDel.asp'>修改/删除学生信息模块：</a><br>" & vbCrLf
    Response.Write "                &nbsp;&nbsp;&nbsp;&nbsp;首先使用查询功能查询出需要修改/删除的记录，然后进行修改/删除操作。<br>" & vbCrLf
    Response.Write "                &nbsp;&nbsp;&nbsp;&nbsp;可以批量删除记录。 </li>" & vbCrLf
    Response.Write "              <br>" & vbCrLf
    Response.Write "              <br>" & vbCrLf
    Response.Write "              <li>打印学生信息模块<br>" & vbCrLf
    Response.Write "                &nbsp;&nbsp;&nbsp;&nbsp;将查询结果以我们常见的成绩表形式打印出来，并可以自定义打印格式； </li>" & vbCrLf
    Response.Write "              <br>" & vbCrLf
    Response.Write "              <br>" & vbCrLf
    Response.Write "              <li>班级管理模块：<br>" & vbCrLf
    Response.Write "                &nbsp;&nbsp;&nbsp;&nbsp;添加/删除班级，结果会直接影响“按班级查询”方式。<br>" & vbCrLf
    Response.Write "              </li>" & vbCrLf
    Response.Write "            </ul>" & vbCrLf
    Response.Write "          </td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "      </table>" & vbCrLf
    Response.Write "  </tr></table>" & vbCrLf
End Sub

Sub InfoInput()
    Dim strStudentNum, strplace, strClassID, strGradeID
    strClassID = Trim(Request("ClassID"))
    strGradeID = Trim(Request("GradeID"))
    strStudentNum = ReplaceBadChar(Request("StudentNum"))
    strplace = ReplaceBadChar(Request("place"))

    Response.Write "    <script language=""JavaScript"">" & vbCrLf
    Response.Write "        function checkform()" & vbCrLf
    Response.Write "        {" & vbCrLf
    Response.Write "          var strStudentNum" & vbCrLf
    Response.Write "          strStudentNum=document.form1.StudentNum.value" & vbCrLf
    Response.Write "          if(strStudentNum=="""")" & vbCrLf
    Response.Write "          {" & vbCrLf
    Response.Write "            alert(""你还没有填学号！"");" & vbCrLf
    Response.Write "            document.form1.StudentNum.focus();" & vbCrLf
    Response.Write "            return false;" & vbCrLf
    Response.Write "          }" & vbCrLf
    Response.Write "          " & vbCrLf
    Response.Write "          if(document.form1.Name.value=="""")" & vbCrLf
    Response.Write "          {" & vbCrLf
    Response.Write "            alert(""你还没有填姓名！"");" & vbCrLf
    Response.Write "            document.form1.Name.focus();" & vbCrLf
    Response.Write "            return false;" & vbCrLf
    Response.Write "          }" & vbCrLf
    Response.Write "        }" & vbCrLf
    Response.Write "        function SetEnrollment()" & vbCrLf
    Response.Write "        {" & vbCrLf
    Response.Write "          var strStudentNum;" & vbCrLf
    Response.Write "          strStudentNum=document.form1.StudentNum.value;" & vbCrLf
    Response.Write "          if(strStudentNum>=4)" & vbCrLf
    Response.Write "          {" & vbCrLf
    Response.Write "            document.form1.enrollment.value=strStudentNum.substring(0,4)+""-9-1"";" & vbCrLf
    Response.Write "          }" & vbCrLf
    Response.Write "        }" & vbCrLf
    Response.Write "        function ChangeClass(num)" & vbCrLf
    Response.Write "        {" & vbCrLf
    Response.Write "            var i;" & vbCrLf
    Response.Write "            var j;" & vbCrLf
    Response.Write "            for(i=document.form1.ClassSelect.options.length-1;i>=0;i--)" & vbCrLf
    Response.Write "            {" & vbCrLf
    Response.Write "                document.form1.ClassSelect.options[i]=null;" & vbCrLf
    Response.Write "            }" & vbCrLf
    Response.Write "" & vbCrLf
    Response.Write "            for(j=0;j<document.Classes.all(""Grade""+num).options.length;j++)" & vbCrLf
    Response.Write "            {" & vbCrLf
    Response.Write "                document.form1.ClassSelect.options[j]=new Option(document.Classes.all(""Grade""+num).options[j].text,document.Classes.all(""Grade""+num).options[j].value);" & vbCrLf
    Response.Write "            }" & vbCrLf
    Response.Write "        }" & vbCrLf
    Response.Write "    </script>" & vbCrLf
    Call PopCalendarInit
    Response.Write "    <div id='Layer1' style='position:absolute; left:445px; top:220px; width:188px; height:64px; z-index:1; visibility: hidden;'> " & vbCrLf

    Response.Write GetClass_Option(1)
    Response.Write "    </div>" & vbCrLf
    Response.Write "        <br>" & vbCrLf
    Response.Write "        <table width='100%' class='border' border='0' cellspacing='1' cellpadding='4' align='center'>" & vbCrLf
    Response.Write "          <tr>" & vbCrLf
    Response.Write "            <td align='center' class='title' colspan='2'> <b>学 生 信 息 录 入</b> </td>" & vbCrLf
    Response.Write "          </tr>" & vbCrLf
    Response.Write "          <form name=form1 onSubmit='return checkform()' action='Admin_StudentInfoManage.asp' method='POST'>"
    If strStudentNum <> "" Then Response.Write "<br><b>你所录入的学生信息已经保存！请继续录入下一条记录。</b><br><br>" & vbCrLf
    Response.Write "            <tr class='tdbg'>" & vbCrLf
    Response.Write "              <td align=right width='30%'><strong>学号：<br>" & vbCrLf
    Response.Write "                    <br>" & vbCrLf
    Response.Write "              </strong></td>" & vbCrLf
    Response.Write "              <td align=left>" & vbCrLf
    Response.Write "                <input class=rec_form size=12 name=StudentNum maxlength='16' value='" & strStudentNum & "' onChange=""SetEnrollment()"">" & vbCrLf
    Response.Write "                <font color='#FF0000'>*</font> <br>" & vbCrLf
    Response.Write "                学号构成参考规则：入学时间+班级+学生号码<br>" & vbCrLf
    Response.Write "                例如：<font color='#9900FF'>2004</font><font color='#006600'>06</font><font color='#990000'>34</font>：指2004届6班的编号为34的学生。</td>" & vbCrLf
    Response.Write "            </tr>" & vbCrLf
    Response.Write "            <tr class='tdbg'>" & vbCrLf
    Response.Write "              <td align=right width='30%'><strong>姓名：</strong></td>" & vbCrLf
    Response.Write "              <td align=left>" & vbCrLf
    Response.Write "                <input class=rec_form size=12 name=Name maxlength='10'>" & vbCrLf
    Response.Write "                <font color='#FF0000'>*</font> </td>" & vbCrLf
    Response.Write "            </tr>" & vbCrLf
    Response.Write "            <tr class='tdbg'>" & vbCrLf
    Response.Write "              <td align=right width='30%'><strong>年级：</strong></td>" & vbCrLf
    Response.Write "              <td align=left>" & vbCrLf
    Response.Write "               <select name='Grade' onChange='ChangeClass(this.value)'>" & vbCrLf
    Response.Write "" & vbCrLf

    If strGradeID = "" Or IsNull(strGradeID) Then
        Response.Write GetGrade_Option
    Else
        Dim rsGKind, strOption, i

        Set rsGKind = Conn_Sdms.Execute("select * from Grade where Disabled=false order by OrderID asc")
        Do While Not rsGKind.EOF
            strOption = strOption & "<option value='" & rsGKind("GradeID") & "'"
            If strGradeID = rsGKind("GradeID") Then
                strOption = strOption & " selected"
            End If
            strOption = strOption & ">" & rsGKind("GradeName") & "</option>"
            rsGKind.MoveNext
        Loop
        Set rsGKind = Nothing

        Response.Write strOption
    End If
    Response.Write "                        </select>" & vbCrLf
    Response.Write "                <font color='#FF0000'>*</font> </td>" & vbCrLf
    Response.Write "            </tr>" & vbCrLf
    Response.Write "                <tr class='tdbg'>" & vbCrLf
    Response.Write "              <td align=right width='30%'><strong>班级：</strong></td>" & vbCrLf
    Response.Write "              <td align=left>" & vbCrLf
    Response.Write "                <select name='ClassSelect'>" & vbCrLf

    Dim RsFirst, FirstGradeID, Sqlin, Rsin
    Set RsFirst = Conn_Sdms.Execute("select top 1 GradeID from Grade order by OrderID asc")
    If strClassID = "" Or IsNull(strClassID) Then
        If RsFirst.EOF And RsFirst.BOF Then
            FirstGradeID = 0
        Else
            FirstGradeID = RsFirst("GradeID")
        End If
    Else
        FirstGradeID = strGradeID
    End If
    Set RsFirst = Nothing
    Set Rsin = Server.CreateObject("ADODB.REcordset")
    Sqlin = "select * from Class where GradeID=" & FirstGradeID & " order by OrderID asc"
    Rsin.Open Sqlin, Conn_Sdms, 1, 3
    Do While Not Rsin.EOF
        If strClassID = Rsin("ClassID") Then
            Response.Write "<option value='" & Rsin("ClassID") & "' Selected>" & Rsin("ClassName") & "</option>"
        Else
            Response.Write "<option value='" & Rsin("ClassID") & "' >" & Rsin("ClassName") & "</option>"
        End If
        Rsin.MoveNext
    Loop
    Set Rsin = Nothing

    Response.Write "                </select>" & vbCrLf
    Response.Write "                <font color='#FF0000'>*</font> </td>" & vbCrLf
    Response.Write "            </tr>" & vbCrLf
    Response.Write "            <tr class='tdbg'>" & vbCrLf
    Response.Write "              <td align=right width='30%'><strong>性别：</strong></td>" & vbCrLf
    Response.Write "              <td align=left>" & vbCrLf
    Response.Write "                <select name=Sex>" & vbCrLf
    Response.Write "                  <option value='男' selected>男</option>" & vbCrLf
    Response.Write "                  <option value='女'>女</option>" & vbCrLf
    Response.Write "                </select>" & vbCrLf
    Response.Write "              </td>" & vbCrLf
    Response.Write "            </tr>" & vbCrLf
    Response.Write "            <tr class='tdbg'>" & vbCrLf
    Response.Write "              <td align=right width='30%'><strong>民族：</strong></td>" & vbCrLf
    Response.Write "              <td align=left>" & vbCrLf
    Response.Write "                <select name=Folk>" & vbCrLf
    Response.Write "                  <option value='汉族' selected>汉族</option>" & vbCrLf
    Response.Write "                  <option value='蒙古族'>蒙古族 </option>" & vbCrLf
    Response.Write "                  <option value='回族'>回族 </option>" & vbCrLf
    Response.Write "                  <option value='藏族'>藏族 </option>" & vbCrLf
    Response.Write "                  <option value='苗族'>苗族 </option>" & vbCrLf
    Response.Write "                  <option value='彝族'>彝族 </option>" & vbCrLf
    Response.Write "                  <option value='壮族'>壮族 </option>" & vbCrLf
    Response.Write "                  <option value='布依族'>布依族 </option>" & vbCrLf
    Response.Write "                  <option value='朝鲜族'>朝鲜族 </option>" & vbCrLf
    Response.Write "                  <option value='满族'>满族 </option>" & vbCrLf
    Response.Write "                  <option value='侗族'>侗族 </option>" & vbCrLf
    Response.Write "                  <option value='瑶族'>瑶族 </option>" & vbCrLf
    Response.Write "                  <option value='白族'>白族 </option>" & vbCrLf
    Response.Write "                  <option value='土家族'>土家族 </option>" & vbCrLf
    Response.Write "                  <option value='哈尼族'>哈尼族 </option>" & vbCrLf
    Response.Write "                  <option value='哈萨克族'>哈萨克族 </option>" & vbCrLf
    Response.Write "                  <option value='傣族'>傣族 </option>" & vbCrLf
    Response.Write "                  <option value='黎族'>黎族 </option>" & vbCrLf
    Response.Write "                  <option value='傈僳族'>傈僳族 </option>" & vbCrLf
    Response.Write "                  <option value='佤族'>佤族 </option>" & vbCrLf
    Response.Write "                  <option value='畲族'>畲族 </option>" & vbCrLf
    Response.Write "                  <option value='高山族'>高山族 </option>" & vbCrLf
    Response.Write "                  <option value='拉祜族'>拉祜族 </option>" & vbCrLf
    Response.Write "                  <option value='水族'>水族 </option>" & vbCrLf
    Response.Write "                  <option value='东乡族'>东乡族 </option>" & vbCrLf
    Response.Write "                  <option value='纳西族'>纳西族 </option>" & vbCrLf
    Response.Write "                  <option value='景颇族'>景颇族 </option>" & vbCrLf
    Response.Write "                  <option value='柯尔克孜族'>柯尔克孜族 </option>" & vbCrLf
    Response.Write "                  <option value='土族'>土族 </option>" & vbCrLf
    Response.Write "                  <option value='达乌尔族'>达乌尔族 </option>" & vbCrLf
    Response.Write "                  <option value='羌族'>羌族 </option>" & vbCrLf
    Response.Write "                  <option value='仫佬族'>仫佬族 </option>" & vbCrLf
    Response.Write "                  <option value='布朗族'>布朗族 </option>" & vbCrLf
    Response.Write "                  <option value='撒拉族'>撒拉族 </option>" & vbCrLf
    Response.Write "                  <option value='毛难族'>毛难族 </option>" & vbCrLf
    Response.Write "                  <option value='仡佬族'>仡佬族 </option>" & vbCrLf
    Response.Write "                  <option value='锡伯族'>锡伯族 </option>" & vbCrLf
    Response.Write "                  <option value='阿昌族'>阿昌族 </option>" & vbCrLf
    Response.Write "                  <option value='普米族'>普米族 </option>" & vbCrLf
    Response.Write "                  <option value='塔吉克族'>塔吉克族 </option>" & vbCrLf
    Response.Write "                  <option value='怒族'>怒族 </option>" & vbCrLf
    Response.Write "                  <option value='乌孜别克族'>乌孜别克族 </option>" & vbCrLf
    Response.Write "                  <option value='俄罗斯族'>俄罗斯族 </option>" & vbCrLf
    Response.Write "                  <option value='鄂温克族'>鄂温克族 </option>" & vbCrLf
    Response.Write "                  <option value='崩龙族'>崩龙族 </option>" & vbCrLf
    Response.Write "                  <option value='保安族'>保安族 </option>" & vbCrLf
    Response.Write "                  <option value='裕固族'>裕固族 </option>" & vbCrLf
    Response.Write "                  <option value='京族'>京族 </option>" & vbCrLf
    Response.Write "                  <option value='维吾尔族'>维吾尔族 </option>" & vbCrLf
    Response.Write "                  <option value='塔塔尔族'>塔塔尔族 </option>" & vbCrLf
    Response.Write "                  <option value='独龙族'>独龙族 </option>" & vbCrLf
    Response.Write "                  <option value='鄂伦春族'>鄂伦春族 </option>" & vbCrLf
    Response.Write "                  <option value='赫哲族'>赫哲族 </option>" & vbCrLf
    Response.Write "                  <option value='门巴族'>门巴族 </option>" & vbCrLf
    Response.Write "                  <option value='珞巴族'>珞巴族 </option>" & vbCrLf
    Response.Write "                  <option value='基诺族'>基诺族 </option>" & vbCrLf
    Response.Write "                  <option value='其他'>其他</option>" & vbCrLf
    Response.Write "                </select>" & vbCrLf
    Response.Write "              </td>" & vbCrLf
    Response.Write "            </tr>" & vbCrLf
    Response.Write "            <tr class='tdbg'>" & vbCrLf
    Response.Write "              <td align=right width='30%'><strong>籍贯：</strong></td>" & vbCrLf
    Response.Write "              <td align=left>" & vbCrLf
    Response.Write "                <input name=place class=rec_form size=12 maxlength='10' value='" & strplace & "'>" & vbCrLf
    Response.Write "              </td>" & vbCrLf
    Response.Write "            </tr>" & vbCrLf
    Response.Write "            <tr class='tdbg'>" & vbCrLf
    Response.Write "              <td align=right width='30%'><strong>政治面貌：</strong></td>" & vbCrLf
    Response.Write "              <td align=left>" & vbCrLf
    Response.Write "                <select name=politics>" & vbCrLf
    Response.Write "                  <option value='团员'>团员 </option>" & vbCrLf
    Response.Write "                  <option value='少先队员'>少先队员 </option>" & vbCrLf
    Response.Write "                  <option value='党员'>党员 </option>" & vbCrLf
    Response.Write "                  <option value='群众'>群众 </option>" & vbCrLf
    Response.Write "                  <option value='其它' selected>其它</option>" & vbCrLf
    Response.Write "                </select>" & vbCrLf
    Response.Write "              </td>" & vbCrLf
    Response.Write "            </tr>" & vbCrLf
    Response.Write "            <tr class='tdbg'>" & vbCrLf
    Response.Write "              <td align=right width='30%'><strong>出生日期：</strong></td>" & vbCrLf
    Response.Write "              <td align=left><input name=Birthday class=rec_form value='1991-11-11' size=12><a style='cursor:hand;' onClick=""PopCalendar.show(document.form1.Birthday, 'yyyy-mm-dd', null, null, null, '11');""><img src='Images/Calendar.gif' border='0' Style='Padding-Top:10px' align='absmiddle'></a>" & vbCrLf
    Response.Write "                例：1991-3-18</td>" & vbCrLf
    Response.Write "            </tr>" & vbCrLf
    Response.Write "            <tr class='tdbg'>" & vbCrLf
    Response.Write "              <td align=right width='30%'><strong>入学时间：</strong></td>" & vbCrLf
    Response.Write "              <td align=left>" & vbCrLf
    Response.Write "                <input class=rec_form size=12 name=enrollment value='" & FormatDateTime(Date, 2) & "'><a style='cursor:hand;' onClick=""PopCalendar.show(document.form1.enrollment, 'yyyy-mm-dd', null, null, null, '11');""><img src='Images/Calendar.gif' border='0' Style='Padding-Top:10px' align='absmiddle'></a>" & vbCrLf
    Response.Write "                例：2004-9-1</td>" & vbCrLf
    Response.Write "            </tr>" & vbCrLf
    Response.Write "            <tr class='tdbg'>" & vbCrLf
    Response.Write "              <td align=right width='30%'><strong>家长姓名：</strong></td>" & vbCrLf
    Response.Write "              <td>" & vbCrLf
    Response.Write "                <input class=rec_form size=19 " & vbCrLf
    Response.Write "                                      name=housemaster maxlength='8'>" & vbCrLf
    Response.Write "              </td>" & vbCrLf
    Response.Write "            </tr>" & vbCrLf
    Response.Write "            <tr class='tdbg'>" & vbCrLf
    Response.Write "              <td align=right width='30%'><strong>联系电话：</strong></td>" & vbCrLf
    Response.Write "              <td>" & vbCrLf
    Response.Write "                <input class=rec_form size=19 " & vbCrLf
    Response.Write "                                      name=TelNum maxlength='20'>" & vbCrLf
    Response.Write "                例：26332702；13512345678</td>" & vbCrLf
    Response.Write "            </tr>" & vbCrLf
    Response.Write "            <tr class='tdbg'>" & vbCrLf
    Response.Write "              <td width='30%' align=right><strong>家庭地址：</strong></td>" & vbCrLf
    Response.Write "              <td><b>" & vbCrLf
    Response.Write "                <input class=rec_form size=50 name=HouseAddress maxlength='50'>" & vbCrLf
    Response.Write "              </b></td>" & vbCrLf
    Response.Write "            </tr>" & vbCrLf
    Response.Write "            <tr class='tdbg'>" & vbCrLf
    Response.Write "              <td width='30%' align=right valign='top'><strong>备注：</strong></td>" & vbCrLf
    Response.Write "              <td><textarea name='remark' cols='48' rows='4' class='rec_form'></textarea></td>" & vbCrLf
    Response.Write "            </tr>" & vbCrLf
    Response.Write "            <tr class='tdbg'>" & vbCrLf
    Response.Write "              <td height='40' colspan='2' align=center valign='middle'>" & vbCrLf
    Response.Write "" & vbCrLf
    If strStudentNum <> "" Then
         Response.Write "<script language='JavaScript'>document.form1.Name.focus();</script>"
    Else
         Response.Write "<script language='JavaScript'>document.form1.StudentNum.focus();</script>"
    End If

    Response.Write "                <input type='hidden' name='Action' value='SaveAdd'>" & vbCrLf
    Response.Write "                <input id=submit type=submit value=保存录入信息 name=submit>" & vbCrLf
    Response.Write "              </td>" & vbCrLf
    Response.Write "            </tr>" & vbCrLf
    Response.Write "          </form>" & vbCrLf
    Response.Write "        </table>" & vbCrLf
    Response.Write "        </FORM>" & vbCrLf
    Response.Write "        <p> <br>" & vbCrLf
    Response.Write "                        <strong>注：</strong><br>" & vbCrLf
    Response.Write "                   " & vbCrLf
    Response.Write "                        　　1、带*项为必填项" & vbCrLf
    Response.Write "                        <br>" & vbCrLf
    Response.Write "                        　　2、<font color='#FF0000'>学号不能重复！</font>若学号重复系统会自动转入修改学生信息页面<br>" & vbCrLf
    Response.Write "                        " & vbCrLf
    Response.Write "                        　　3、输入信息后可直接按回车键保存录入信息<br>" & vbCrLf
    Response.Write "                      " & vbCrLf
    Response.Write "                        　　4、输入过程中可用Tab键将光标在各输入框中切换<br>" & vbCrLf
    Response.Write "                       " & vbCrLf
    Response.Write "                        　　5、录入记录后，学号会自动加1<br>" & vbCrLf
    Response.Write "                       " & vbCrLf
    Response.Write "                        　　6、入学时间会根据学号自动改变</p>" & vbCrLf
    Response.Write "" & vbCrLf

End Sub

Sub SaveAdd()
    Dim rsInfo, sqlInfo
    Dim StudentNum, name, Sex, Folk, place, politics, Birthday, enrollment, housemaster, Remark, ClassSelect, Grade, TelNum, HouseAddress
    StudentNum = Trim(Request.Form("StudentNum"))
    name = Trim(Request.Form("Name"))
    Sex = Trim(Request.Form("Sex"))
    Folk = Trim(Request.Form("Folk"))
    place = Trim(Request.Form("place"))
    politics = Trim(Request.Form("politics"))
    Birthday = Trim(Request.Form("Birthday"))
    enrollment = Trim(Request.Form("enrollment"))
    housemaster = Trim(Request.Form("housemaster"))
    TelNum = Trim(Request.Form("TelNum"))
    HouseAddress = Trim(Request.Form("HouseAddress"))
    Remark = Trim(Request.Form("remark"))
    ClassSelect = Trim(Request.Form("ClassSelect"))
    Grade = Trim(Request.Form("Grade"))
    
    If StudentNum = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>学生学号不能为空！！！</li>"
        Exit Sub
    Else
        Dim rsKey
        Set rsKey = Conn_Sdms.Execute("SELECT StudentNum FROM StudentInfo WHERE StudentNum='" & ReplaceBadChar(StudentNum) & "'")
        If Not rsKey.EOF Or Not rsKey.BOF Then
            FoundErr = True
            ErrMsg = ErrMsg & "<br><li>所输入的学号与数据库中的重复！！！</li>"
            Exit Sub
        End If
        Set rsKey = Nothing
    End If
    If name = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>学生姓名不能为空！！！</li>"
        Exit Sub
    End If
    If ClassSelect = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>学生所在班级不能为空！！！</li>"
        Exit Sub
    Else
        ClassSelect = PE_CLng(ClassSelect)
    End If
    If Grade = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>学生所在年级不能为空！！！</li>"
        Exit Sub
    Else
        Grade = PE_CLng(Grade)
    End If
    If Birthday = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>学生生日不能为空！！！</li>"
        Exit Sub
    End If
    If Birthday <> "" And IsDate(Birthday) = False Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>输入的生日不是规则日期！！！</li>"
        Exit Sub
    End If
    If enrollment = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>学生入学时间不能为空！！！</li>"
        Exit Sub
    End If
    If enrollment <> "" And IsDate(enrollment) = False Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>输入的入学时间不是规则日期！！！</li>"
        Exit Sub
    End If

    Set rsInfo = Server.CreateObject("adodb.recordset")
    sqlInfo = "select * from StudentInfo"
    rsInfo.Open sqlInfo, Conn_Sdms, 1, 3
    rsInfo.addnew
    rsInfo("StudentNum") = ReplaceBadChar(StudentNum)
    rsInfo("Name") = ReplaceBadChar(Replace(name, " ", ""))
    rsInfo("Sex") = Sex
    rsInfo("Folk") = Folk
    rsInfo("place") = place
    rsInfo("politics") = politics
    rsInfo("Birthday") = Birthday
    rsInfo("enrollment") = enrollment
    rsInfo("housemaster") = housemaster
    rsInfo("remark") = Remark
    rsInfo("ClassID") = ClassSelect
    rsInfo("TelNum") = TelNum
    rsInfo("HouseAddress") = HouseAddress
    rsInfo("GradeID") = Grade
    rsInfo.Update
    rsInfo.Close
    Set rsInfo = Nothing

    Dim editRedirectUrl
    editRedirectUrl = "Admin_StudentInfoManage.asp?Action=InfoInput&GradeID=" & Grade & "&ClassID=" & ClassSelect
    If (place <> "") Then
        editRedirectUrl = editRedirectUrl & "&place=" & place
    End If

    Response.Redirect (editRedirectUrl)

End Sub

Sub InfoQuery()
    Response.Write "" & vbCrLf
    Response.Write "<script language=""JavaScript"" type=""text/JavaScript"">" & vbCrLf
    Response.Write "    function check1()" & vbCrLf
    Response.Write "    {" & vbCrLf
    Response.Write "      if(document.form1.StudentNum.value=="""")" & vbCrLf
    Response.Write "      {" & vbCrLf
    Response.Write "        alert(""你还没有填学号"");" & vbCrLf
    Response.Write "        document.form1.StudentNum.focus();" & vbCrLf
    Response.Write "        return false;" & vbCrLf
    Response.Write "      }" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "    function check2()" & vbCrLf
    Response.Write "    {" & vbCrLf
    Response.Write "      if(document.form2.Name.value=="""")" & vbCrLf
    Response.Write "      {" & vbCrLf
    Response.Write "        alert(""你还没有填姓名"");" & vbCrLf
    Response.Write "        document.form2.Name.focus();" & vbCrLf
    Response.Write "        return false;" & vbCrLf
    Response.Write "      }" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "    function ChangeClass(num)" & vbCrLf
    Response.Write "    {" & vbCrLf
    Response.Write "        var i;" & vbCrLf
    Response.Write "        var j;" & vbCrLf
    Response.Write "        for(i=document.form3.ClassSelect.options.length-1;i>=0;i--)" & vbCrLf
    Response.Write "        {" & vbCrLf
    Response.Write "            document.form3.ClassSelect.options[i]=null;" & vbCrLf
    Response.Write "        }" & vbCrLf
    Response.Write "" & vbCrLf
    Response.Write "        for(j=0;j<document.Classes.all(""Grade""+num).options.length;j++)" & vbCrLf
    Response.Write "        {" & vbCrLf
    Response.Write "            document.form3.ClassSelect.options[j]=new Option(document.Classes.all(""Grade""+num).options[j].text,document.Classes.all(""Grade""+num).options[j].value);" & vbCrLf
    Response.Write "        }" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "</script>" & vbCrLf

    Response.Write "<div id='Layer1' style='position:absolute; left:445px; top:220px; width:188px; height:64px; z-index:1; visibility: hidden;'> " & vbCrLf
    Response.Write GetClass_Option(0)
    Response.Write "</div>" & vbCrLf
    Response.Write "" & vbCrLf
    Response.Write "<br>" & vbCrLf
    Response.Write "<table width='100%' class='border' border='0' cellspacing='1' cellpadding='4' align='center'> " & vbCrLf
    Response.Write "  <tr>  " & vbCrLf
    Response.Write "    <td align='center' class='title' colspan='3'>  " & vbCrLf
    Response.Write "      <b>学 生 信 息 查 询</b><b>(请输入查询的条件)</b> " & vbCrLf
    Response.Write "    </td> " & vbCrLf
    Response.Write "  </tr>" & vbCrLf
    Response.Write "          <form Name='form1' onSubmit='return check1()' action='Admin_StudentInfoManage.asp?Action=InfoQueryResult' method='post'>" & vbCrLf
    Response.Write "            <tr class='tdbg'> " & vbCrLf
    Response.Write "              <td width='20%' align='right' nowrap><strong>按学号查询：</strong></td>" & vbCrLf
    Response.Write "              <td width='150'> <input name='StudentNum' type='text' id='StudentNum' size='18' maxlength='16'></td>" & vbCrLf
    Response.Write "              <td width='44'> <input type='submit' name='Submit1' value='查询'></td>" & vbCrLf
    Response.Write "            </tr>" & vbCrLf
    Response.Write "          </form>" & vbCrLf
    Response.Write "          <form Name='form2' onSubmit='return check2()'  action='Admin_StudentInfoManage.asp?Action=InfoQueryResult' method='post'>" & vbCrLf
    Response.Write "            <tr class='tdbg'> " & vbCrLf
    Response.Write "              <td width='20%' align='right' nowrap><strong>按姓名查询：</strong></td>" & vbCrLf
    Response.Write "              <td width='150'> <input type='text' name='Name' maxlength='8' size='18'></td>" & vbCrLf
    Response.Write "              <td> <input type='submit' name='Submit2' value='查询'></td>" & vbCrLf
    Response.Write "            </tr>" & vbCrLf
    Response.Write "          </form>" & vbCrLf
    Response.Write "          <form Name='form3' action='Admin_StudentInfoManage.asp?Action=InfoQueryResult' method='post'>" & vbCrLf
    Response.Write "            <tr class='tdbg'> " & vbCrLf
    Response.Write "              <td width='20%' align='right' nowrap><strong>按班级查询：</strong></td>" & vbCrLf
    Response.Write "              <td width='150' nowrap> <select name='Grade' onChange=""ChangeClass(this.value)"">" & vbCrLf
    Response.Write "" & vbCrLf
    Response.Write GetGrade_Option
    Response.Write "                </select>" & vbCrLf
    Response.Write "                <select name='ClassSelect'>" & vbCrLf
    Response.Write "                  <option value='All' selected>全级</option>" & vbCrLf
    Response.Write "" & vbCrLf

    Dim RsFirst, FirstGradeID
    Set RsFirst = Conn_Sdms.Execute("select top 1 GradeID from Grade order by OrderID asc")
    If RsFirst.EOF And RsFirst.BOF Then
        FirstGradeID = 0
    Else
        FirstGradeID = RsFirst("GradeID")
    End If
    Set RsFirst = Nothing

    Dim Rsin, Sqlin
    Set Rsin = Server.CreateObject("ADODB.REcordset")
    Sqlin = "select * from Class where GradeID=" & FirstGradeID & " order by OrderID asc"
    Rsin.Open Sqlin, Conn_Sdms, 1, 3
    Do While Not Rsin.EOF
        Response.Write "<option value='" & Rsin("ClassID") & "' >" & Rsin("ClassName") & "</option>"
        Rsin.MoveNext
    Loop
    Set Rsin = Nothing

    Response.Write "                </select></td>" & vbCrLf
    Response.Write "              <td> <input type='submit' name='Submit3' value='查询'></td>" & vbCrLf
    Response.Write "            </tr>" & vbCrLf
    Response.Write "          </form>" & vbCrLf
    Response.Write "</table>" & vbCrLf
    Response.Write "        <p><b>注：</b><br>" & vbCrLf
    Response.Write "          　　1、可从学号、姓名或班级三种查询方法任选其一进行查询。<br>" & vbCrLf
    Response.Write "          <font color='#FF0000'>" & vbCrLf
    Response.Write "          　　2、支持模糊查询！</font><br>" & vbCrLf
    Response.Write "          例如：<br>" & vbCrLf
    Response.Write "          　　在学号查询框中输入2001，则查询结果为学号中包含“2001”的学生<br>" & vbCrLf
    Response.Write "          　　在姓名中输入“小”，则查询结果为姓名中包含有“小”的学生<br>" & vbCrLf
    Response.Write "          <br>" & vbCrLf
    Response.Write "          <br>" & vbCrLf
    Response.Write "        </p>" & vbCrLf
    Response.Write "" & vbCrLf
End Sub

Sub InfoQueryResult()

    Response.Write "<script language=""JavaScript"" type=""text/JavaScript"">" & vbCrLf
    Response.Write "    function check1()" & vbCrLf
    Response.Write "    {" & vbCrLf
    Response.Write "      if(document.form1.StudentNum.value=="""")" & vbCrLf
    Response.Write "      {" & vbCrLf
    Response.Write "        alert(""你还没有填学号"");" & vbCrLf
    Response.Write "        document.form1.StudentNum.focus();" & vbCrLf
    Response.Write "        return false;" & vbCrLf
    Response.Write "      }" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "    function check2()" & vbCrLf
    Response.Write "    {" & vbCrLf
    Response.Write "      if(document.form2.Name.value=="""")" & vbCrLf
    Response.Write "      {" & vbCrLf
    Response.Write "        alert(""你还没有填姓名"");" & vbCrLf
    Response.Write "        document.form2.Name.focus();" & vbCrLf
    Response.Write "        return false;" & vbCrLf
    Response.Write "      }" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "    function ChangeClass(num)" & vbCrLf
    Response.Write "    {" & vbCrLf
    Response.Write "        var i;" & vbCrLf
    Response.Write "        var j;" & vbCrLf
    Response.Write "        for(i=document.form3.ClassSelect.options.length-1;i>=0;i--)" & vbCrLf
    Response.Write "        {" & vbCrLf
    Response.Write "            document.form3.ClassSelect.options[i]=null;" & vbCrLf
    Response.Write "        }" & vbCrLf
    Response.Write "" & vbCrLf
    Response.Write "        for(j=0;j<document.Classes.all(""Grade""+num).options.length;j++)" & vbCrLf
    Response.Write "        {" & vbCrLf
    Response.Write "            document.form3.ClassSelect.options[j]=new Option(document.Classes.all(""Grade""+num).options[j].text,document.Classes.all(""Grade""+num).options[j].value);" & vbCrLf
    Response.Write "        }   " & vbCrLf
    Response.Write "        " & vbCrLf
    Response.Write "" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "</script>" & vbCrLf

    Response.Write "<div id='Layer1' style='position:absolute; left:445px; top:220px; width:188px; height:64px; z-index:1; visibility: hidden;'> " & vbCrLf
    Response.Write "" & vbCrLf
    Response.Write GetClass_Option(0)
    Response.Write "</div>" & vbCrLf
    Response.Write "<br><table width='100%'><tr><td align='left'>您现在的位置：学生信息查询 &nbsp;&gt;&gt;&nbsp;"
    Response.Write "" & vbCrLf
    Dim rs, sql, strStudentNum, strName, strGrade, strClass, TotalPut
    Set rs = Server.CreateObject("ADODB.Recordset")
    strStudentNum = ReplaceBadChar(Trim(Request("StudentNum")))
    strName = ReplaceBadChar(Trim(Request("Name")))
    strGrade = PE_CLng(Trim(Request("Grade")))
    strClass = Trim(Request("ClassSelect"))
    strFileName = "Admin_StudentInfoManage.asp?Action=InfoQueryResult&StudentNum=" & strStudentNum & "&Name=" & strName & "&Grade=" & strGrade & "&ClassSelect=" & strClass
    sql = "SELECT *  FROM StudentInfo "
    If strStudentNum <> "" Then
        sql = sql & "WHERE StudentNum like '%" & strStudentNum & "%'  ORDER BY StudentNum"
    End If
    If strName <> "" Then
        sql = sql & "WHERE Name like '%" & strName & "%'  ORDER BY StudentNum"
    End If
    If strGrade <> "" And strClass <> "" Then
        If strClass = "All" Then
            sql = sql & "WHERE GradeID=" & strGrade & " ORDER BY StudentNum"
        Else
            sql = sql & "WHERE GradeID=" & strGrade & " and ClassID=" & PE_CLng(strClass) & "  ORDER BY StudentNum"
        End If
    End If

    rs.Open sql, Conn_Sdms, 1, 1
    If rs.BOF And rs.EOF Then
        Response.Write "查询结果</td><td align='right'>共找到 <font color=red>0</font> 条学生记录</td></tr></table>"
    Else
        TotalPut = rs.RecordCount
        If strStudentNum <> "" Then
            Response.Write "学号中含有“" & strStudentNum & "”"
        ElseIf strName <> "" Then
            Response.Write "姓名中含有“" & strName & "”"
        Else
            If strClass <> "" Then
                Dim SearchResult, strSearch, GradeName
                If Trim(strClass) = "All" Then
                    strClass = " 全级"
                    Set GradeName = Conn_Sdms.Execute("Select GradeName From Grade Where GradeID=" & strGrade & "")
                    strSearch = GradeName(0) & " " & strClass
                    Set GradeName = Nothing
                Else
                    
                    Set SearchResult = Conn_Sdms.Execute("Select G.GradeName,C.ClassName From Class C Left join Grade G On C.GradeID= G.GradeID Where C.GradeID=" & strGrade & " And C.ClassID=" & PE_CLng(strClass) & "")
                    strSearch = SearchResult(0) & " " & SearchResult(1)
                    Set SearchResult = Nothing
                End If
                Response.Write strSearch
            Else
                Response.Write "所有学生信息"
            End If
        End If
        Response.Write "</td><td align='right'>共找到 <font color=red>" & TotalPut & "</font> 条学生记录</td></tr></table>"
    End If
    If CurrentPage < 1 Then
        CurrentPage = 1
    End If
    If (CurrentPage - 1) * MaxPerPage > TotalPut Then
        If (TotalPut Mod MaxPerPage) = 0 Then
            CurrentPage = TotalPut \ MaxPerPage
        Else
            CurrentPage = TotalPut \ MaxPerPage + 1
        End If
    End If
    If CurrentPage > 1 Then
        If (CurrentPage - 1) * MaxPerPage < TotalPut Then
            rs.Move (CurrentPage - 1) * MaxPerPage
        Else
            CurrentPage = 1
        End If
    End If
    Response.Write "        <table width='100%' class='border' border='0' cellspacing='1' cellpadding='4' align='center'>" & vbCrLf
    Response.Write "          <tr valign='middle' class='title'> " & vbCrLf
    Response.Write "            <td  align='center' nowrap>" & vbCrLf
    Response.Write "              学 号</td>" & vbCrLf
    Response.Write "            <td  align='center' nowrap>姓名</td>" & vbCrLf
    Response.Write "            <td  align='center' nowrap>性别</td>" & vbCrLf
    Response.Write "            <td  align='center' nowrap>民族</td>" & vbCrLf
    Response.Write "            <td  align='center' nowrap>籍贯</td>" & vbCrLf
    Response.Write "            <td  align='center' nowrap>政治面貌</td>" & vbCrLf
    Response.Write "            <td  align='center' nowrap>出生日期</td>" & vbCrLf
    Response.Write "            <td  align='center' nowrap>入学时间</td>" & vbCrLf
    Response.Write "            <td  align='center' nowrap>家长姓名</td>" & vbCrLf
    Response.Write "            <td  align='center' nowrap>联系电话</td>" & vbCrLf
    Response.Write "            <td  align='center' nowrap>家庭住址</td>" & vbCrLf
    Response.Write "          </tr>" & vbCrLf
    If rs.RecordCount = 0 Then
        Response.Write "<tr class='tdbg'><td colspan='10' align='center'>没有满足条件的记录!</td><tr>" & vbCrLf
    Else
        Dim rsID, i, Sort
        i = 0
        Do While Not rs.EOF
            Response.Write "          <tr class='tdbg' onmouseout=this.style.backgroundColor='' onmouseover=this.style.backgroundColor='#BFDFFF'>  " & vbCrLf
            Response.Write "            <td height='26'  align='center' nowrap>" & rs("StudentNum") & "</td>" & vbCrLf
            Response.Write "            <td  align='center' nowrap>" & rs("Name") & "</td>" & vbCrLf
            Response.Write "            <td  align='center' nowrap>" & rs("Sex") & "</td>" & vbCrLf
            Response.Write "            <td  align='center' nowrap>" & rs("Folk") & "</td>" & vbCrLf
            Response.Write "            <td  align='center'>" & rs("place") & "</td>" & vbCrLf
            Response.Write "            <td  align='center' nowrap>" & rs("Politics") & "</td>" & vbCrLf
            Response.Write "            <td  align='left' nowrap>" & rs("Birthday") & "</td>" & vbCrLf
            Response.Write "            <td  align='center' nowrap>" & rs("Enrollment") & "</td>" & vbCrLf
            Response.Write "            <td  align='center' nowrap>" & rs("Housemaster") & "</td>" & vbCrLf
            Response.Write "            <td  align='center' nowrap>" & rs("Telnum") & "</td>" & vbCrLf
            Response.Write "            <td  align='left'>" & rs("HouseAddress") & "</td>" & vbCrLf
            Response.Write "          </tr>" & vbCrLf
            i = i + 1
            If i > MaxPerPage Then Exit Do
            rs.MoveNext
        Loop
    End If
    Response.Write "  </table>" & vbCrLf
    If TotalPut > 0 Then
        Response.Write ShowPage(strFileName, TotalPut, MaxPerPage, CurrentPage, True, True, "条记录", True)
    End If
    Response.Write ShowSearch()
End Sub

Function ShowSearch()
    Response.Write "        <TABLE width='100%' border=1 cellPadding=5 cellSpacing=0 bordercolor='#FFCCFF'>" & vbCrLf
    Response.Write "                <TBODY>" & vbCrLf
    Response.Write "                  <TR> " & vbCrLf
    Response.Write "                    <TD vAlign=top> <b>继续查询其他学生信息</b> <table width='300' border='0' cellspacing='0' cellpadding='5'>" & vbCrLf
    Response.Write "                        <form Name='form1' onSubmit='return check1()' action='Admin_StudentInfoManage.asp?Action=InfoQueryResult' method='post'>" & vbCrLf
    Response.Write "                          <tr> " & vbCrLf
    Response.Write "                            <td width='80' align='right' nowrap>按学号查询：</td>" & vbCrLf
    Response.Write "                            <td width='150'> <input name='StudentNum' type='text' id='StudentNum' size='18' maxlength='8'></td>" & vbCrLf
    Response.Write "                            <td> <input type='submit' name='Submit1' value='查询'></td>" & vbCrLf
    Response.Write "                          </tr>" & vbCrLf
    Response.Write "                        </form>" & vbCrLf
    Response.Write "                        <form Name='form2' onSubmit='return check2()'  action='Admin_StudentInfoManage.asp?Action=InfoQueryResult' method='post'>" & vbCrLf
    Response.Write "                          <tr> " & vbCrLf
    Response.Write "                            <td width='80' align='right' nowrap>按姓名查询：</td>" & vbCrLf
    Response.Write "                            <td width='150'> <input type='text' name='Name' maxlength='8' size='18'></td>" & vbCrLf
    Response.Write "                            <td> <input type='submit' name='Submit2' value='查询'></td>" & vbCrLf
    Response.Write "                          </tr>" & vbCrLf
    Response.Write "                        </form>" & vbCrLf
    Response.Write "                        <form Name='form3' action='Admin_StudentInfoManage.asp?Action=InfoQueryResult' method='post'>" & vbCrLf
    Response.Write "                          <tr> " & vbCrLf
    Response.Write "                            <td width='80' align='right' nowrap>按班级查询：</td>" & vbCrLf
    Response.Write "                            " & vbCrLf
    Response.Write "                      <td width='150' nowrap> <select name='Grade' onChange=""ChangeClass(this.value)"">" & vbCrLf
    Response.Write GetGrade_Option
    Response.Write "                        </select>" & vbCrLf
    Response.Write "                        <select name='ClassSelect'>" & vbCrLf
    Response.Write "                          <option value='All' selected>全级</option>" & vbCrLf
    Response.Write "" & vbCrLf
    Dim RsFirst, FirstGradeID, Sqlin, Rsin
    Set RsFirst = Conn_Sdms.Execute("select top 1 GradeID from Grade order by OrderID asc")
    If RsFirst.EOF And RsFirst.BOF Then
        FirstGradeID = 0
    Else
        FirstGradeID = RsFirst("GradeID")
    End If
    Set RsFirst = Nothing
    Set Rsin = Server.CreateObject("ADODB.REcordset")
    Sqlin = "select * from Class where GradeID=" & FirstGradeID & " order by OrderID asc"
    Rsin.Open Sqlin, Conn_Sdms, 1, 3
    Do While Not Rsin.EOF
        Response.Write "<option value='" & Rsin("ClassID") & "' >" & Rsin("ClassName") & "</option>"
        Rsin.MoveNext
    Loop
    Set Rsin = Nothing

    Response.Write "                        </select></td>" & vbCrLf
    Response.Write "                            <td> <input type='submit' name='Submit3' value='查询'></td>" & vbCrLf
    Response.Write "                          </tr>" & vbCrLf
    Response.Write "                        </form>" & vbCrLf
    Response.Write "                      </table></TD>" & vbCrLf
    Response.Write "                    <TD><b>注：</b> <br>" & vbCrLf
    Response.Write "                      1、可从学号、姓名或班级三种查询方法任选其一进行查询。<br> <font color='#FF0000'>2、支持模糊查询！</font><br>" & vbCrLf
    Response.Write "                      例如：<br> &nbsp;&nbsp;&nbsp;&nbsp;在学号查询框中输入2001，则查询结果为学号中包含“2001”的学生<br> " & vbCrLf
    Response.Write "                      &nbsp;&nbsp;&nbsp;&nbsp;在姓名中输入“小”，则查询结果为姓名中包含有“小”的学生 </TD>" & vbCrLf
    Response.Write "                  </TR>" & vbCrLf
    Response.Write "        </TABLE></TD>" & vbCrLf
    Response.Write "    </TR>" & vbCrLf
    Response.Write "  </TBODY>" & vbCrLf
    Response.Write "</TABLE>" & vbCrLf
    Response.Write "" & vbCrLf

End Function

Sub InfoModifyList()
    Response.Write "<SCRIPT language=javascript>" & vbCrLf
    Response.Write "    function unselectall()" & vbCrLf
    Response.Write "    {" & vbCrLf
    Response.Write "        if(document.del.chkAll.checked){" & vbCrLf
    Response.Write "        document.del.chkAll.checked = document.del.chkAll.checked&0;" & vbCrLf
    Response.Write "        }   " & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "" & vbCrLf
    Response.Write "    function CheckAll(form)" & vbCrLf
    Response.Write "      {" & vbCrLf
    Response.Write "      for (var i=0;i<form.elements.length;i++)" & vbCrLf
    Response.Write "        {" & vbCrLf
    Response.Write "        var e = form.elements[i];" & vbCrLf
    Response.Write "        if (e.Name != 'chkAll')" & vbCrLf
    Response.Write "           e.checked = form.chkAll.checked;" & vbCrLf
    Response.Write "        }" & vbCrLf
    Response.Write "      }" & vbCrLf
    Response.Write "    function ConfirmDel()" & vbCrLf
    Response.Write "    {" & vbCrLf
    Response.Write "       if(confirm(""确定要删除选中的记录吗？一旦删除将不能恢复！""))" & vbCrLf
    Response.Write "         return true;" & vbCrLf
    Response.Write "       else" & vbCrLf
    Response.Write "         return false;" & vbCrLf
    Response.Write "         " & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "" & vbCrLf
    Response.Write "</SCRIPT>" & vbCrLf
    Response.Write "" & vbCrLf
    Dim Rs1, Rs1Sql
    Set Rs1 = Server.CreateObject("ADODB.Recordset")

    Response.Write "<br><table width='100%'><tr><td align='left'>您现在的位置：学生信息查询 &nbsp;&gt;&gt;&nbsp;"
    Response.Write "" & vbCrLf

    If Request.QueryString <> "" Then Session("strQureyString") = Request.QueryString
    If Request.Form <> "" Then Session("strQureyString") = Request.Form

    If strStudentNum <> "" Then
      Rs1Sql = "SELECT * FROM StudentInfo WHERE StudentNum like '%" & strStudentNum & "%' ORDER BY StudentNum"
    End If
    If strName <> "" Then
      Rs1Sql = "SELECT * FROM StudentInfo WHERE Name like '%" & strName & "%' ORDER BY StudentNum"
    End If
    If strGrade <> "" And strClass <> "" Then
        If strClass = "All" Then
            Rs1Sql = "SELECT * FROM StudentInfo WHERE GradeID=" & strGrade & " ORDER BY StudentNum"
        Else
            Rs1Sql = "SELECT * FROM StudentInfo WHERE GradeID=" & strGrade & " and ClassID=" & PE_CLng(strClass) & "  ORDER BY StudentNum"
        End If
    End If
    If Rs1Sql = "" Then
        Rs1Sql = "SELECT top 20 * FROM StudentInfo ORDER BY StudentNum"
    End If
    Rs1.Open Rs1Sql, Conn_Sdms, 1, 3
    If strStudentNum <> "" Then
        Response.Write "学号中含有“" & strStudentNum & "”"
    ElseIf strName <> "" Then
        Response.Write "姓名中含有“" & strName & "”"
    Else
        If strClass <> "" And strGrade <> "" Then
            Dim SearchResult, strSearch, GradeName
            If Trim(strClass) = "All" Then
                strClass = " 全级"
                Set GradeName = Conn_Sdms.Execute("Select GradeName From Grade Where GradeID=" & strGrade & "")
                strSearch = GradeName(0) & " " & strClass
                Set GradeName = Nothing
            Else
                Set SearchResult = Conn_Sdms.Execute("Select G.GradeName,C.ClassName From Class C Left join Grade G On C.GradeID= G.GradeID Where C.ClassID=" & PE_CLng(strClass) & "")
                strSearch = SearchResult(0) & " " & SearchResult(1)
                Set SearchResult = Nothing
            End If
            Response.Write strSearch
        Else
            Response.Write "前20条学生信息"
        End If
    End If
    Dim TotalPut
    If Rs1.BOF And Rs1.EOF Then
        Response.Write "</td><td align='right'>共找到 <font color=red>0</font> 条学生记录</td></tr></table>"
    Else
        TotalPut = Rs1.RecordCount
        Response.Write "</td><td align='right'>共找到 <font color=red>" & TotalPut & "</font> 条学生记录</td></tr></table>"
    End If

    Response.Write "        <table width='100%' class='border' border='0' cellspacing='1' cellpadding='4' align='center'>" & vbCrLf
    Response.Write "         <form Name='del' onsubmit='return ConfirmDel()' method='post' action='Admin_StudentInfoManage.asp?Action=BatchDel'>  " & vbCrLf
    Response.Write "         <tr valign='middle' class='title'> " & vbCrLf
    Response.Write "            <td width='5%' align='center'>删除</td>" & vbCrLf
    Response.Write "            <td width='6%' align='center'>学号</td>" & vbCrLf
    Response.Write "            <td width='7%' align='center'>姓名</td>" & vbCrLf
    Response.Write "            <td width='5%' align='center'>性别</td>" & vbCrLf
    Response.Write "            <td width='5%' align='center'>民族</td>" & vbCrLf
    Response.Write "            <td width='5%' align='center'>籍贯</td>" & vbCrLf
    Response.Write "            <td width='6%' align='center'>政治<br>面貌</td>" & vbCrLf
    Response.Write "            <td width='9%' align='center'>出生日期</td>" & vbCrLf
    Response.Write "            <td width='9%' align='center'>入学时间</td>" & vbCrLf
    Response.Write "            <td width='8%' align='center'>家长姓名</td>" & vbCrLf
    Response.Write "            <td width='9%' align='center'>联系电话</td>" & vbCrLf
    Response.Write "            <td width='15%' align='center'>家庭住址</td>" & vbCrLf
    Response.Write "              <td width='10%' align='center'>操作</td>" & vbCrLf
    Response.Write "            </tr>" & vbCrLf
    Response.Write "" & vbCrLf
    If Rs1.RecordCount = 0 Then
        Response.Write "<tr class='tdbg'><td colspan='13' align='center'>没有满足条件的记录!</td><tr>" & vbCrLf
    Else
        Do While Not Rs1.EOF
            Response.Write "          <tr class='tdbg' onmouseout=this.style.backgroundColor='' onmouseover=this.style.backgroundColor='#BFDFFF'>  " & vbCrLf
            Response.Write "              <td width='5%' height='28' align='center'> " & vbCrLf
            Response.Write "                <input type='checkbox' value='" & Rs1("StudentNum") & "' onclick=""unselectall()"" Name='chkNum'>            </td>" & vbCrLf
            Response.Write "            <td width='6%' align='center'> " & Rs1("StudentNum") & "</td>" & vbCrLf
            Response.Write "            <td width='7%' align='center'>" & Rs1("Name") & "</td>" & vbCrLf
            Response.Write "            <td width='5%' align='center'>" & Rs1("Sex") & "</td>" & vbCrLf
            Response.Write "            <td width='5%' align='center'>" & Rs1("Folk") & "</td>" & vbCrLf
            Response.Write "            <td width='5%' align='center'>" & Rs1("place") & "</td>" & vbCrLf
            Response.Write "            <td width='6%' align='center'>" & Rs1("Politics") & "</td>" & vbCrLf
            Response.Write "            <td width='9%' align='center'>" & Rs1("Birthday") & "</td>" & vbCrLf
            Response.Write "            <td width='9%' align='center'>" & Rs1("Enrollment") & "</td>" & vbCrLf
            Response.Write "            <td width='8%' align='center'>" & Rs1("Housemaster") & "</td>" & vbCrLf
            Response.Write "            <td width='9%' align='center'>" & Rs1("Telnum") & "</td>" & vbCrLf
            Response.Write "            <td width='15%' align='center'>" & Rs1("HouseAddress") & "</td>" & vbCrLf
            Response.Write "            <td width='10%' align='center'>" & vbCrLf
            Response.Write "      <a href='" & strFileName & "&Action=Modify&StudentNum=" & Rs1("StudentNum") & "'>修改</a>&nbsp;<a href='" & strFileName & "&Action=Del&StudentNum=" & Rs1("StudentNum") & "' onClick=""return confirm('确定要删除此条学生记录吗？');"">删除</a>"
            'Response.Write "      <a href='InfoModify.asp?Action=Modify&StudentNum=" & Rs1("StudentNum") & "'>修改</a>&nbsp;<a href='" & strFileName & "&Action=Del&StudentNum=" & Rs1("StudentNum") & "' onClick=""return confirm('确定要删除此条学生记录吗？');"">删除</a>"
            Response.Write "            </td>" & vbCrLf
            Response.Write "          </tr>" & vbCrLf
            Rs1.MoveNext
        Loop
    End If
    Response.Write "  </table>" & vbCrLf
    Response.Write "          <table border='0' cellspacing='0' cellpadding='0' align='left'>" & vbCrLf
    Response.Write "            <tr> " & vbCrLf
    Response.Write "              <td width='104'> <input type='checkbox' Name='chkAll' value='1' onclick=""CheckAll(this.form)"">" & vbCrLf
    Response.Write "                全部选定</td>" & vbCrLf
    Response.Write "              <td width='104'>&nbsp; </td>" & vbCrLf
    Response.Write "              <td width='46'> <input type='submit' Name='Submit' value='删除选定的记录'> " & vbCrLf
    Response.Write "              </td>" & vbCrLf
    Response.Write "            </tr>" & vbCrLf
    Response.Write "          </table>" & vbCrLf
    Response.Write "        </form>" & vbCrLf
    Rs1.Close
    Set Rs1 = Nothing
End Sub

Sub InfoModifyDel()
    Response.Write "" & vbCrLf
    Response.Write "<script language=""JavaScript"" type=""text/JavaScript"">" & vbCrLf
    Response.Write "    function check1()" & vbCrLf
    Response.Write "    {" & vbCrLf
    Response.Write "      if(document.form1.StudentNum.value=="""")" & vbCrLf
    Response.Write "      {" & vbCrLf
    Response.Write "        alert(""你还没有填学号"");" & vbCrLf
    Response.Write "        document.form1.StudentNum.focus();" & vbCrLf
    Response.Write "        return false;" & vbCrLf
    Response.Write "      }" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "    function check2()" & vbCrLf
    Response.Write "    {" & vbCrLf
    Response.Write "      if(document.form2.Name.value=="""")" & vbCrLf
    Response.Write "      {" & vbCrLf
    Response.Write "        alert(""你还没有填姓名"");" & vbCrLf
    Response.Write "        document.form2.Name.focus();" & vbCrLf
    Response.Write "        return false;" & vbCrLf
    Response.Write "      }" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "    function ChangeClass(num)" & vbCrLf
    Response.Write "    {" & vbCrLf
    Response.Write "        var i;" & vbCrLf
    Response.Write "        var j;" & vbCrLf
    Response.Write "        for(i=document.form3.ClassSelect.options.length-1;i>=0;i--)" & vbCrLf
    Response.Write "        {" & vbCrLf
    Response.Write "            document.form3.ClassSelect.options[i]=null;" & vbCrLf
    Response.Write "        }" & vbCrLf
    Response.Write "" & vbCrLf
    Response.Write "        for(j=0;j<document.Classes.all(""Grade""+num).options.length;j++)" & vbCrLf
    Response.Write "        {" & vbCrLf
    Response.Write "            document.form3.ClassSelect.options[j]=new Option(document.Classes.all(""Grade""+num).options[j].text,document.Classes.all(""Grade""+num).options[j].value);" & vbCrLf
    Response.Write "        }" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "</script>" & vbCrLf

    Response.Write "<div id='Layer1' style='position:absolute; left:445px; top:220px; width:188px; height:64px; z-index:1; visibility: hidden;'> " & vbCrLf
    Response.Write GetClass_Option(0)
    Response.Write "</div>" & vbCrLf
    Response.Write "<br>" & vbCrLf
    Response.Write "<table width='100%' class='border' border='0' cellspacing='1' cellpadding='4' align='center'> " & vbCrLf
    Response.Write "  <tr>  " & vbCrLf
    Response.Write "    <td align='center' class='title' colspan='3'>  " & vbCrLf
    Response.Write "      <b>学 生 信 息 修 改 / 删 除<b>(请首先查询需修改或删除的学生记录)</b></b> " & vbCrLf
    Response.Write "    </td> " & vbCrLf
    Response.Write "  </tr>" & vbCrLf
    Response.Write "          <form Name='form1' onSubmit='return check1()' action='Admin_StudentInfoManage.asp?Action=InfoModifyList' method='post'>" & vbCrLf
    Response.Write "            <tr class='tdbg'> " & vbCrLf
    Response.Write "              <td width='20%' align='right'><strong>按学号查询：</strong></td>" & vbCrLf
    Response.Write "              <td width='150'> <input name='StudentNum' type='text' size='18' maxlength='16'></td>" & vbCrLf
    Response.Write "              <td> <input name='Submit1' type='submit' value='查询'></td>" & vbCrLf
    Response.Write "            </tr>" & vbCrLf
    Response.Write "          </form>" & vbCrLf
    Response.Write "          <form Name='form2' onSubmit='return check2()'  action='Admin_StudentInfoManage.asp?Action=InfoModifyList' method='post'>" & vbCrLf
    Response.Write "            <tr class='tdbg'> " & vbCrLf
    Response.Write "              <td width='20%' align='right'><strong>按姓名查询：</strong></td>" & vbCrLf
    Response.Write "              <td width='150'> <input name='Name' type='text' size='18' maxlength='8'></td>" & vbCrLf
    Response.Write "              <td> <input name='Submit2' type='submit' value='查询'></td>" & vbCrLf
    Response.Write "            </tr>" & vbCrLf
    Response.Write "          </form>" & vbCrLf
    Response.Write "          <form Name='form3' action='Admin_StudentInfoManage.asp?Action=InfoModifyList' method='post'>" & vbCrLf
    Response.Write "            <tr class='tdbg'> " & vbCrLf
    Response.Write "              <td width='20%' align='right'><strong>按班级查询：</strong></td>" & vbCrLf
    Response.Write "              <td width='150' nowrap> <select name='Grade' onChange=""ChangeClass(this.value)"">" & vbCrLf
    Response.Write GetGrade_Option
    Response.Write "                </select> <select name='ClassSelect'>" & vbCrLf
    Response.Write "                  <option value='All' selected>全级</option>" & vbCrLf
    Response.Write "" & vbCrLf
    Dim RsFirst, FirstGradeID, Rsin, Sqlin
    Set RsFirst = Conn_Sdms.Execute("select top 1 GradeID from Grade order by OrderID asc")
    If RsFirst.EOF And RsFirst.BOF Then
        FirstGradeID = 0
    Else
        FirstGradeID = RsFirst("GradeID")
    End If
    Set RsFirst = Nothing
    Set Rsin = Server.CreateObject("ADODB.REcordset")
    Sqlin = "select * from Class where GradeID=" & FirstGradeID & " order by OrderID asc"
    Rsin.Open Sqlin, Conn_Sdms, 1, 3
    Do While Not Rsin.EOF
        Response.Write "<option value='" & Rsin("ClassID") & "' >" & Rsin("ClassName") & "</option>"
        Rsin.MoveNext
    Loop
    Set Rsin = Nothing

    Response.Write "                </select></td>" & vbCrLf
    Response.Write "              <td> <input name='Submit3' type='submit' value='查询'></td>" & vbCrLf
    Response.Write "            </tr>" & vbCrLf
    Response.Write "          </form>" & vbCrLf
    Response.Write "</table>" & vbCrLf
    Response.Write "        <p> <strong>注：</strong><br>" & vbCrLf
    Response.Write "          　　1、要修改或删除学生信息记录,首先查询需要修改或删除的学生记录以供修改或删除。<br>" & vbCrLf
    Response.Write "" & vbCrLf
    Response.Write "          　　2、可从学号、姓名或班级三种查询方法任选其一进行查询。" & vbCrLf
    Response.Write "          <font color='#FF0000'><br>" & vbCrLf
    Response.Write "          　　3、支持模糊查询！</font><br>" & vbCrLf
    Response.Write "          例如：<br>" & vbCrLf
    Response.Write "          　　在学号查询框中输入2001，则查询结果为学号中包含“2001”的学生<br>" & vbCrLf
    Response.Write "          　　在姓名中输入“小”，则查询结果为姓名中包含有“小”的学生<br>" & vbCrLf
    Response.Write "          <br>" & vbCrLf
End Sub


Sub ModifyInfo()
    Response.Write "<script language=""JavaScript"">" & vbCrLf
    Response.Write "function checkform()" & vbCrLf
    Response.Write "{" & vbCrLf
    Response.Write "  if(document.form1.Name.value=="""")" & vbCrLf
    Response.Write "  {" & vbCrLf
    Response.Write "    alert(""你还没有填姓名"");" & vbCrLf
    Response.Write "    document.form1.Name.focus();" & vbCrLf
    Response.Write "    return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "</script>" & vbCrLf
    Response.Write "" & vbCrLf
    Dim strStudentNum, rsStudent, SqlStudent
    strStudentNum = ReplaceBadChar(Trim(Request("StudentNum")))
    If strStudentNum = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>学号不能为空！！！</li>"
        Exit Sub
    End If
    Set rsStudent = Server.CreateObject("ADODB.Recordset")
    SqlStudent = "SELECT * FROM StudentInfo WHERE StudentNum = '" & strStudentNum & "'"
    rsStudent.Open SqlStudent, Conn_Sdms, 1, 3
    If rsStudent.EOF And rsStudent.BOF Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>数据库中无此记录。</li>"
        Exit Sub
    End If
    Response.Write "<br>" & vbCrLf
    Response.Write "    <table width='100%' class='border' border='0' cellspacing='1' cellpadding='4' align='center'> " & vbCrLf
    Response.Write "      <tr>  " & vbCrLf
    Response.Write "        <td align='center' class='title'>  " & vbCrLf
    Response.Write "          <b>学 生 信 息 修 改</b> " & vbCrLf
    Response.Write "        </td> " & vbCrLf
    Response.Write "      </tr>" & vbCrLf
    Response.Write "    </table>" & vbCrLf
    Response.Write "    <table width='100%' border=0 align='center' cellPadding=0 cellSpacing=0>" & vbCrLf
    Response.Write "      <TBODY>" & vbCrLf
    Response.Write "        <TR> " & vbCrLf
    Response.Write "          <TD > <table width='100%' border='0' cellpadding='0' cellspacing='0'>" & vbCrLf
    Response.Write "              <tr> " & vbCrLf
    Response.Write "                <TD width='200' vAlign=top> <p> <br>" & vbCrLf
    Response.Write "                    <strong>注：</strong><br>" & vbCrLf
    Response.Write "                    <br>" & vbCrLf
    Response.Write "                    1、带*项为必填项<br>" & vbCrLf
    Response.Write "                    <br>" & vbCrLf
    Response.Write "                    2、输入信息后可直接按回车键保存修改结果<br>" & vbCrLf
    Response.Write "                    <br>" & vbCrLf
    Response.Write "                    3、输入过程中可用Tab键将光标在各输入框中切换<br>" & vbCrLf
    Response.Write "                    <br>" & vbCrLf
    Response.Write "                    5、保存修改结果后，系统会自动转入录入下一条记录页面或查询结果结果页面。</p></TD>" & vbCrLf
    Response.Write "                <td width='10' valign='top'> <table height='300' border='0' align='center' cellpadding='0' cellspacing='0'>" & vbCrLf
    Response.Write "                    <tr> " & vbCrLf
    Response.Write "                       " & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                  </table></td>" & vbCrLf
    Response.Write "                <TD align='center'>" & vbCrLf
    Response.Write "                  <form Name='form1' onsubmit='return checkform()' action='" & strFileName & "' method='POST'>" & vbCrLf
    Response.Write "                    <table width='100%' border=0 cellpadding='0' cellspacing=2>" & vbCrLf
    Response.Write "                      <tr> " & vbCrLf
    Response.Write "                        <td align=right width=80>学号：</td>" & vbCrLf
    Response.Write "                        <td align=left width=426>" & vbCrLf
    Response.Write rsStudent("StudentNum")
    If Request("Err") <> "" Then
        Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;<font color='ff0000'>此学号已存在！</font>"
        Response.Write "<input name='RedirectUrl' type='hidden' value='Admin_StudentInfoManage.asp'>"
    End If
    Response.Write "                     </td>" & vbCrLf
    Response.Write "                      </tr>" & vbCrLf
    Response.Write "                      <tbody>" & vbCrLf
    Response.Write "                        <tr> " & vbCrLf
    Response.Write "                          <td align=right width=80>姓名：</td>" & vbCrLf
    Response.Write "                          <td align=left width=426> <input class='rec_form' size='12'  maxlength='10' Name='Name' value='" & rsStudent("Name") & "'>" & vbCrLf
    Response.Write "                            <font color='#FF0000'>*</font> </td>" & vbCrLf
    Response.Write "                        </tr>" & vbCrLf
    Response.Write "                        <tr> " & vbCrLf
    Response.Write "                          <td align=right width='80'>性别：</td>" & vbCrLf
    Response.Write "" & vbCrLf
    Response.Write "                          <td align=left width='426'> <select Name=Sex>" & vbCrLf
    Response.Write "                              <option value='男'" & vbCrLf
    If rsStudent("Sex") = "男" Then Response.Write " selected " & vbCrLf
    Response.Write "                              >男</option>" & vbCrLf
    Response.Write "                              <option value='女'" & vbCrLf
    If rsStudent("Sex") = "女" Then Response.Write " selected " & vbCrLf
    Response.Write "                              >女</option>" & vbCrLf
    Response.Write "" & vbCrLf
    Response.Write "                            </select> </td>" & vbCrLf
    Response.Write "                        </tr>" & vbCrLf
    Response.Write "                        <tr> " & vbCrLf
    Response.Write "                          <td align=right width='80'>民族：</td>" & vbCrLf
    Response.Write "                          <td align=left width='426'> <select Name=Folk>" & vbCrLf
    Response.Write "                              <option value='汉族'>汉族 </option>" & vbCrLf
    Response.Write "                              <option value='蒙古族'>蒙古族 </option>" & vbCrLf
    Response.Write "                              <option value='回族'>回族 </option>" & vbCrLf
    Response.Write "                              <option value='藏族'>藏族 </option>" & vbCrLf
    Response.Write "                              <option value='苗族'>苗族 </option>" & vbCrLf
    Response.Write "                              <option value='彝族'>彝族 </option>" & vbCrLf
    Response.Write "                              <option value='壮族'>壮族 </option>" & vbCrLf
    Response.Write "                              <option value='布依族'>布依族 </option>" & vbCrLf
    Response.Write "                              <option value='朝鲜族'>朝鲜族 </option>" & vbCrLf
    Response.Write "                              <option value='满族'>满族 </option>" & vbCrLf
    Response.Write "                              <option value='侗族'>侗族 </option>" & vbCrLf
    Response.Write "                              <option value='瑶族'>瑶族 </option>" & vbCrLf
    Response.Write "                              <option value='白族'>白族 </option>" & vbCrLf
    Response.Write "                              <option value='土家族'>土家族 </option>" & vbCrLf
    Response.Write "                              <option value='哈尼族'>哈尼族 </option>" & vbCrLf
    Response.Write "                              <option value='哈萨克族'>哈萨克族 </option>" & vbCrLf
    Response.Write "                              <option value='傣族'>傣族 </option>" & vbCrLf
    Response.Write "                              <option value='黎族'>黎族 </option>" & vbCrLf
    Response.Write "                              <option value='傈僳族'>傈僳族 </option>" & vbCrLf
    Response.Write "                              <option value='佤族'>佤族 </option>" & vbCrLf
    Response.Write "                              <option value='畲族'>畲族 </option>" & vbCrLf
    Response.Write "                              <option value='高山族'>高山族 </option>" & vbCrLf
    Response.Write "                              <option value='拉祜族'>拉祜族 </option>" & vbCrLf
    Response.Write "                              <option value='水族'>水族 </option>" & vbCrLf
    Response.Write "                              <option value='东乡族'>东乡族 </option>" & vbCrLf
    Response.Write "                              <option value='纳西族'>纳西族 </option>" & vbCrLf
    Response.Write "                              <option value='景颇族'>景颇族 </option>" & vbCrLf
    Response.Write "                              <option value='柯尔克孜族'>柯尔克孜族 </option>" & vbCrLf
    Response.Write "                              <option value='土族'>土族 </option>" & vbCrLf
    Response.Write "                              <option value='达乌尔族'>达乌尔族 </option>" & vbCrLf
    Response.Write "                              <option value='羌族'>羌族 </option>" & vbCrLf
    Response.Write "                              <option value='仫佬族'>仫佬族 </option>" & vbCrLf
    Response.Write "                              <option value='布朗族'>布朗族 </option>" & vbCrLf
    Response.Write "                              <option value='撒拉族'>撒拉族 </option>" & vbCrLf
    Response.Write "                              <option value='毛难族'>毛难族 </option>" & vbCrLf
    Response.Write "                              <option value='仡佬族'>仡佬族 </option>" & vbCrLf
    Response.Write "                              <option value='锡伯族'>锡伯族 </option>" & vbCrLf
    Response.Write "                              <option value='阿昌族'>阿昌族 </option>" & vbCrLf
    Response.Write "                              <option value='普米族'>普米族 </option>" & vbCrLf
    Response.Write "                              <option value='塔吉克族'>塔吉克族 </option>" & vbCrLf
    Response.Write "                              <option value='怒族'>怒族 </option>" & vbCrLf
    Response.Write "                              <option value='乌孜别克族'>乌孜别克族 </option>" & vbCrLf
    Response.Write "                              <option value='俄罗斯族'>俄罗斯族 </option>" & vbCrLf
    Response.Write "                              <option value='鄂温克族'>鄂温克族 </option>" & vbCrLf
    Response.Write "                              <option value='崩龙族'>崩龙族 </option>" & vbCrLf
    Response.Write "                              <option value='保安族'>保安族 </option>" & vbCrLf
    Response.Write "                              <option value='裕固族'>裕固族 </option>" & vbCrLf
    Response.Write "                              <option value='京族'>京族 </option>" & vbCrLf
    Response.Write "                              <option value='维吾尔族'>维吾尔族 </option>" & vbCrLf
    Response.Write "                              <option value='塔塔尔族'>塔塔尔族 </option>" & vbCrLf
    Response.Write "                              <option value='独龙族'>独龙族 </option>" & vbCrLf
    Response.Write "                              <option value='鄂伦春族'>鄂伦春族 </option>" & vbCrLf
    Response.Write "                              <option value='赫哲族'>赫哲族 </option>" & vbCrLf
    Response.Write "                              <option value='门巴族'>门巴族 </option>" & vbCrLf
    Response.Write "                              <option value='珞巴族'>珞巴族 </option>" & vbCrLf
    Response.Write "                              <option value='基诺族'>基诺族 </option>" & vbCrLf
    Response.Write "                              <option value='其他'>其他</option>" & vbCrLf
    Response.Write "                          <option value='" & rsStudent("Folk") & "' selected >" & rsStudent("Folk") & "</option>" & vbCrLf
    Response.Write "                            </select> </td>" & vbCrLf
    Response.Write "                        </tr>" & vbCrLf
    Response.Write "                        <tr> " & vbCrLf
    Response.Write "                          <td align=right maxlength='10' width='80'>籍贯：</td>" & vbCrLf
    Response.Write "                          <td align=left width='426'>" & vbCrLf
    Response.Write "                                   <input class='rec_form' size='8' Name='place' value='" & rsStudent("place") & "'>" & vbCrLf
    Response.Write "                          </td>" & vbCrLf
    Response.Write "                        </tr>" & vbCrLf
    Response.Write "                        <tr> " & vbCrLf
    Response.Write "                          <td align=right width='80'>政治面貌：</td>" & vbCrLf
    Response.Write "                          <td align=left width='426'> <select Name=politics>" & vbCrLf
    Response.Write "                  <option value='团员'>团员 </option>" & vbCrLf
    Response.Write "                  <option value='少先队员'>少先队员 </option>" & vbCrLf
    Response.Write "                  <option value='党员'>党员 </option>" & vbCrLf
    Response.Write "                  <option value='群众'>群众 </option>" & vbCrLf
    Response.Write "                  <option value='其它' selected>其它</option>" & vbCrLf
    Response.Write "" & vbCrLf
    Response.Write "                <option value='" & rsStudent("politics") & "' selected >" & rsStudent("politics") & "</option>" & vbCrLf
    Response.Write "                            </select> </td>" & vbCrLf
    Response.Write "                        </tr>" & vbCrLf
    Response.Write "                        <tr> " & vbCrLf
    Response.Write "                          <td align=right width='80'>出生日期：</td>" & vbCrLf
    Response.Write "                          <td align=left width='426'>" & vbCrLf
    Response.Write "                            <input class=rec_form size=12 Name=Birthday value='" & rsStudent("Birthday") & "'>" & vbCrLf
    Response.Write "                            例：1991-11-18</td>" & vbCrLf
    Response.Write "                        </tr>" & vbCrLf
    Response.Write "                        <tr> " & vbCrLf
    Response.Write "                          <td align=right width='80'>入学时间：</td>" & vbCrLf
    Response.Write "                          <td align=left width='426'> <input class=rec_form " & vbCrLf
    Response.Write "                                  size=12 Name=enrollment value='" & rsStudent("enrollment") & "'>" & vbCrLf
    Response.Write "                            例：2004-11-18</td>" & vbCrLf
    Response.Write "                        </tr>" & vbCrLf
    Response.Write "                        <tr> " & vbCrLf
    Response.Write "                          <td align=right width=80>家长姓名：</td>" & vbCrLf
    Response.Write "                          <td width=426> <input class=rec_form size=19 maxlength='8'  " & vbCrLf
    Response.Write "                                  Name=housemaster value='" & rsStudent("housemaster") & "'> " & vbCrLf
    Response.Write "                          </td>" & vbCrLf
    Response.Write "                        </tr>" & vbCrLf
    Response.Write "                        <tr> " & vbCrLf
    Response.Write "                          <td align=right width='80'>联系电话：</td>" & vbCrLf
    Response.Write "                          <td width='426'> <input class=rec_form size=19 maxlength='20'  " & vbCrLf
    Response.Write "                                  Name=TelNum value='" & rsStudent("TelNum") & "'> " & vbCrLf
    Response.Write "                          </td>" & vbCrLf
    Response.Write "                        </tr>" & vbCrLf
    Response.Write "                        <tr> " & vbCrLf
    Response.Write "                          <td align=right width='80'>家庭地址：</td>" & vbCrLf
    Response.Write "                          <td width='426'><b> " & vbCrLf
    Response.Write "                            <input class=rec_form size=50  maxlength='50' Name=HouseAddress value='" & rsStudent("HouseAddress") & "'>" & vbCrLf
    Response.Write "                            </b></td>" & vbCrLf
    Response.Write "                        </tr>" & vbCrLf
    Response.Write "                        <tr> " & vbCrLf
    Response.Write "                          <td width='80' align=right valign='top'>备注：</td>" & vbCrLf
    Response.Write "                          <td width='426'> <textarea Name='remark' cols='48' rows='4' class='rec_form'>" & rsStudent("remark") & "</textarea> " & vbCrLf
    Response.Write "                          </td>" & vbCrLf
    Response.Write "                        </tr>" & vbCrLf
    Response.Write "                      </tbody>" & vbCrLf
    Response.Write "                    </table>" & vbCrLf
    Response.Write "" & vbCrLf
    Response.Write "<script language='JavaScript'>document.form1.Name.focus();</script>" & vbCrLf
    Response.Write "" & vbCrLf
    Response.Write "                    <input type='hidden' name='Action' value='SaveModify'>" & vbCrLf
    Response.Write "                    <input type='hidden' name='MM_recordId' value='" & rsStudent("StudentNum") & "'>" & vbCrLf
    Response.Write "                    <input id='submit' type='submit' value='保存修改结果' Name='submit'>" & vbCrLf
    Response.Write "                  </form>" & vbCrLf

    Response.Write "" & vbCrLf
    Response.Write "                </td>" & vbCrLf
    Response.Write "              </tr>" & vbCrLf
    Response.Write "            </table></td>" & vbCrLf
    Response.Write "           " & vbCrLf
    Response.Write "        </TR> " & vbCrLf
    Response.Write "      </TBODY>" & vbCrLf
    Response.Write "    </TABLE>" & vbCrLf
    rsStudent.Close
    Set rsStudent = Nothing
End Sub

Sub SaveModify()
    Dim rsInfo, sqlInfo
    Dim StudentNum, name, Sex, Folk, place, politics, Birthday, enrollment, housemaster, Remark, TelNum, HouseAddress
    StudentNum = Trim(Request.Form("MM_recordId"))
    name = Trim(Request.Form("Name"))
    Sex = Trim(Request.Form("Sex"))
    Folk = Trim(Request.Form("Folk"))
    place = Trim(Request.Form("place"))
    politics = Trim(Request.Form("politics"))
    Birthday = Trim(Request.Form("Birthday"))
    enrollment = Trim(Request.Form("enrollment"))
    housemaster = Trim(Request.Form("housemaster"))
    TelNum = Trim(Request.Form("TelNum"))
    HouseAddress = Trim(Request.Form("HouseAddress"))
    Remark = Trim(Request.Form("remark"))
    'ClassSelect = Trim(Request.Form("ClassSelect"))
    'Grade = Trim(Request.Form("Grade"))
    If StudentNum = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>学生学号不能为空！！！</li>"
        Exit Sub
    Else
        StudentNum = ReplaceBadChar(StudentNum)
    End If
    If name = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>学生姓名不能为空！！！</li>"
        Exit Sub
    End If
    If Birthday = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>学生生日不能为空！！！</li>"
        Exit Sub
    End If
    If Birthday <> "" And IsDate(Birthday) = False Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>输入的生日不是规则日期！！！</li>"
        Exit Sub
    End If
    If enrollment = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>学生入学时间不能为空！！！</li>"
        Exit Sub
    End If
    If enrollment <> "" And IsDate(enrollment) = False Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>输入的入学时间不是规则日期！！！</li>"
        Exit Sub
    End If

    Set rsInfo = Server.CreateObject("adodb.recordset")
    sqlInfo = "select * from StudentInfo Where StudentNum='" & StudentNum & "'"
    rsInfo.Open sqlInfo, Conn_Sdms, 1, 3
    rsInfo("Name") = ReplaceBadChar(Replace(name, " ", ""))
    rsInfo("Sex") = Sex
    rsInfo("Folk") = Folk
    rsInfo("place") = place
    rsInfo("politics") = politics
    rsInfo("Birthday") = Birthday
    rsInfo("enrollment") = enrollment
    rsInfo("housemaster") = housemaster
    rsInfo("remark") = Remark
    'rsInfo("ClassID") = ClassSelect
    rsInfo("TelNum") = TelNum
    rsInfo("HouseAddress") = HouseAddress
    'rsInfo("GradeID") = Grade
    rsInfo.Update
    rsInfo.Close
    Set rsInfo = Nothing
    If InStr(LCase(Session("strQureyString")), "action") <= 0 Then
        Response.Redirect "Admin_StudentInfoManage.asp?Action=InfoModifyList&" & Session("strQureyString")
    Else
        Response.Redirect "Admin_StudentInfoManage.asp?" & Session("strQureyString")
    End If
End Sub

Sub DelInfo()
    If strStudentNum <> "" Then
        Conn_Sdms.Execute "delete from StudentInfo where StudentNum = '" & strStudentNum & "'"
    End If
    If InStr(LCase(Session("strQureyString")), "action") <= 0 Then
        Response.Redirect "Admin_StudentInfoManage.asp?Action=InfoModifyList&" & Session("strQureyString")
    Else
        Response.Redirect "Admin_StudentInfoManage.asp?" & Session("strQureyString")
    End If
End Sub

Sub BatchDelInfo()
    Response.Write "<br>" & vbCrLf
    Response.Write "<table width='100%' class='border' border='0' cellspacing='1' cellpadding='4' align='center'> " & vbCrLf
    Response.Write "  <tr>  " & vbCrLf
    Response.Write "    <td align='center' class='title'>  " & vbCrLf
    Response.Write "      <b>学 生 信 息 修 改 / 删 除</b> " & vbCrLf
    Response.Write "    </td> " & vbCrLf
    Response.Write "  </tr>" & vbCrLf
    Response.Write "</table>" & vbCrLf
    Response.Write "<table width='100%' border=0 align='center' cellPadding=0 cellSpacing=0>" & vbCrLf
    Response.Write "  <TBODY>" & vbCrLf
    Response.Write "    <TR> " & vbCrLf
    Response.Write "      <TD align='center' >" & vbCrLf
    Response.Write "          <br>" & vbCrLf
    Response.Write "        <b> " & vbCrLf
    If Not IsEmpty(Request("chkNum")) Then
        Dim strTemp
        strTemp = Request("chkNum")
        If InStr(strTemp, ",") > 0 Then
            Dim arrStudentNum
            arrStudentNum = Split(strTemp, ",")
            Dim ID, i
            For i = LBound(arrStudentNum) To UBound(arrStudentNum)
                ID = CLng(arrStudentNum(i))
                Call DelRecord(ID)
            Next
        Else
            Call DelRecord(CLng(strTemp))
        End If
    Else
        Response.Write "没有选中任何记录！"
    End If
    Response.Write "          <br>" & vbCrLf
    Response.Write "          <br>" & vbCrLf
    Response.Write "          <br>" & vbCrLf
    Response.Write "        <a href='" & strFileName & "'>【返回查询结果页面】</a><br>" & vbCrLf
    Response.Write "          <br>" & vbCrLf
    Response.Write "          <br>" & vbCrLf
    Response.Write "          <br>" & vbCrLf
    Response.Write "          或者继续查询需修改或删除的学生记录：</b><br>" & vbCrLf
    Response.Write "<div id='Layer1' style='position:absolute; left:445px; top:220px; width:188px; height:64px; z-index:1; visibility: hidden;'> " & vbCrLf
    Response.Write GetClass_Option(0)
    Response.Write "</div>" & vbCrLf
    Response.Write "        <table width='300' border='0' cellspacing='0' cellpadding='5'>" & vbCrLf
    Response.Write "          <form Name='form1' onSubmit=""return check1()"" action=Admin_StudentInfoManage.asp?Action=InfoModifyList' method='post'>" & vbCrLf
    Response.Write "            <tr> " & vbCrLf
    Response.Write "              <td>按学号查询：</td>" & vbCrLf
    Response.Write "              <td> <input name='StudentNum' type='text' size='18' maxlength='8'></td>" & vbCrLf
    Response.Write "              <td> <input name='Submit1' type='submit' value='查询'></td>" & vbCrLf
    Response.Write "            </tr>" & vbCrLf
    Response.Write "          </form>" & vbCrLf
    Response.Write "          <form Name='form2' onSubmit=""return check2()"" action='Admin_StudentInfoManage.asp?Action=InfoModifyList' method='post'>" & vbCrLf
    Response.Write "            <tr> " & vbCrLf
    Response.Write "              <td>按姓名查询：</td>" & vbCrLf
    Response.Write "              <td> <input name='Name' type='text' size='18' maxlength='8'></td>" & vbCrLf
    Response.Write "              <td> <input name='Submit2' type='submit' value='查询'></td>" & vbCrLf
    Response.Write "            </tr>" & vbCrLf
    Response.Write "          </form>" & vbCrLf
    Response.Write "          <form Name='form3' action='Admin_StudentInfoManage.asp?Action=InfoModifyList' method='post'>" & vbCrLf
    Response.Write "            <tr> " & vbCrLf
    Response.Write "              <td>按班级查询：</td>" & vbCrLf
    Response.Write "              <td> <select name='Grade' id='Grade'>" & vbCrLf
    Response.Write GetGrade_Option
    Response.Write "                </select> <select name='ClassSelect'>" & vbCrLf
    Response.Write "                  <option value='All' selected>全级</option>" & vbCrLf
    Response.Write "" & vbCrLf
    Dim RsFirst, FirstGradeID, Rsin, Sqlin
    Set RsFirst = Conn_Sdms.Execute("select top 1 GradeID from Grade order by OrderID asc")
    If RsFirst.EOF And RsFirst.BOF Then
        FirstGradeID = 0
    Else
        FirstGradeID = RsFirst("GradeID")
    End If
    Set RsFirst = Nothing
    Set Rsin = Server.CreateObject("ADODB.REcordset")
    Sqlin = "select * from Class where GradeID=" & FirstGradeID & " order by OrderID asc"
    Rsin.Open Sqlin, Conn_Sdms, 1, 3
    Do While Not Rsin.EOF
        Response.Write "<option value='" & Rsin("ClassID") & "' >" & Rsin("ClassName") & "</option>"
        Rsin.MoveNext
    Loop
    Set Rsin = Nothing

    Response.Write "                </select></td>" & vbCrLf
    Response.Write "              <td> <input name='Submit3' type='submit' value='查询'></td>" & vbCrLf
    Response.Write "            </tr>" & vbCrLf
    Response.Write "          </form>" & vbCrLf
    Response.Write "</table>" & vbCrLf
End Sub

Sub DelRecord(StudentNum)
    Conn_Sdms.Execute "delete from StudentInfo where StudentNum = '" & CStr(StudentNum) & "'"
    If Err.Number <> 0 Then
        Err.Clear
        Response.Write "删除 " & CStr(StudentNum) & " 失败！<br>"
    Else
        Response.Write "删除 " & CStr(StudentNum) & " 成功！<br>"
    End If
End Sub

Sub InfoPrint()
    Response.Write "<div id='Layer1' style='position:absolute; left:445px; top:220px; width:188px; height:64px; z-index:1; visibility: hidden;'> " & vbCrLf
    Response.Write GetClass_Option(0)
    Response.Write "</div>" & vbCrLf
    Response.Write "<br>" & vbCrLf
    Response.Write "<table width='100%' class='border' border='0' cellspacing='1' cellpadding='4' align='center'> " & vbCrLf
    Response.Write "  <tr>  " & vbCrLf
    Response.Write "    <td align='center' class='title' colspan='3'>  " & vbCrLf
    Response.Write "    <b>学 生 信 息 打 印</b>----请首先查询要打印的学生记录</td> " & vbCrLf
    Response.Write "  </tr>" & vbCrLf
    Response.Write "          <form Name='form1' action='Admin_StudentInfoManage.asp?Action=InfoPrint2' method='post' target='_blank'>" & vbCrLf
    Response.Write "            <tr class='tdbg'> " & vbCrLf
    Response.Write "              <td width='25%' rowspan='3' align='right'><strong>请输入查询条件：</strong></td>" & vbCrLf
    Response.Write "              <td align='left' nowrap>学号： " & vbCrLf
    Response.Write "                <input name='StudentNum' type='text' size='18' maxlength='8'></td>" & vbCrLf
    Response.Write "              <td><font color='#FF0000'>支持模糊查询！</font>例如：在学号查询框中输入2001，则查询结果为学号中包含“2001”的学生 " & vbCrLf
    Response.Write "              </td>" & vbCrLf
    Response.Write "            </tr>" & vbCrLf
    Response.Write "            <tr class='tdbg'> " & vbCrLf
    Response.Write "              <td align='left' nowrap>姓名： " & vbCrLf
    Response.Write "                <input name='Name' type='text' size='18' maxlength='8'></td>" & vbCrLf
    Response.Write "              <td><font color='#FF0000'>支持模糊查询！</font>例如：在姓名中输入“小”，则查询结果为姓名中包含有“小”的学生 " & vbCrLf
    Response.Write "              </td>" & vbCrLf
    Response.Write "            </tr>" & vbCrLf
    Response.Write "            <tr class='tdbg'> " & vbCrLf
    Response.Write "              <td align='left' nowrap>班级： " & vbCrLf
    Response.Write "                <select name='Grade' onChange='ChangeClass(this.value)'>" & vbCrLf
    Response.Write GetGrade_Option
    Response.Write "" & vbCrLf
    Response.Write "                </select> <select name='ClassSelect'>" & vbCrLf
    Response.Write "                  <option value='All' selected>全级</option>" & vbCrLf
    Response.Write "" & vbCrLf
    Dim RsFirst, FirstGradeID, Rsin, Sqlin
    Set RsFirst = Conn_Sdms.Execute("select top 1 GradeID from Grade order by OrderID asc")
    If RsFirst.EOF And RsFirst.BOF Then
        FirstGradeID = 0
    Else
        FirstGradeID = RsFirst("GradeID")
    End If
    Set RsFirst = Nothing
    Set Rsin = Server.CreateObject("ADODB.REcordset")
    Sqlin = "select * from Class where GradeID=" & FirstGradeID & " order by OrderID asc"
    Rsin.Open Sqlin, Conn_Sdms, 1, 3
    Do While Not Rsin.EOF
        Response.Write "<option value='" & Rsin("ClassID") & "' >" & Rsin("ClassName") & "</option>"
        Rsin.MoveNext
    Loop
    Set Rsin = Nothing

    Response.Write "                </select></td>" & vbCrLf
    Response.Write "              <td>&nbsp; </td>" & vbCrLf
    Response.Write "            </tr>" & vbCrLf
    Response.Write "            <tr class='tdbg'> " & vbCrLf
    Response.Write "              <td align='right'><strong>请选择要打印的字段：</strong></td>" & vbCrLf
    Response.Write "              <td colspan='2' align='left'><table width='100%' border='0' cellspacing='3' cellpadding='0'>" & vbCrLf
    Response.Write "                  <tr> " & vbCrLf
    Response.Write "                    <td><input name='chkStudentNum' type='checkbox' id='chkStudentNum' value='True' checked>" & vbCrLf
    Response.Write "                      学号</td>" & vbCrLf
    Response.Write "                    <td><input name='chkName' type='checkbox' id='chkName' value='True' checked>" & vbCrLf
    Response.Write "                      姓名 </td>" & vbCrLf
    Response.Write "                    <td><input name='chkSex' type='checkbox' id='chkSex' value='True' checked>" & vbCrLf
    Response.Write "                      性别</td>" & vbCrLf
    Response.Write "                    <td><input name='chkFolk' type='checkbox' id='chkFolk' value='True' checked>" & vbCrLf
    Response.Write "                      民族</td>" & vbCrLf
    Response.Write "                    <td><input name='chkPlace' type='checkbox' id='chkPlace' value='True' checked>" & vbCrLf
    Response.Write "                      籍贯</td>" & vbCrLf
    Response.Write "                    <td><input name='chkPolitics' type='checkbox' id='chkPolitics' value='True' checked>" & vbCrLf
    Response.Write "                      政治面貌</td>" & vbCrLf
    Response.Write "                  </tr>" & vbCrLf
    Response.Write "                  <tr> " & vbCrLf
    Response.Write "                    <td><input name='chkBirth' type='checkbox' id='chkBirth' value='True' checked>" & vbCrLf
    Response.Write "                      出生日期</td>" & vbCrLf
    Response.Write "                    <td><input name='chkEnrollment' type='checkbox' id='chkEnrollment' value='True'>" & vbCrLf
    Response.Write "                      入学时间</td>" & vbCrLf
    Response.Write "                    <td><input name='chkHousemaster' type='checkbox' id='chkHousemaster' value='True' checked>" & vbCrLf
    Response.Write "                      家长姓名</td>" & vbCrLf
    Response.Write "                    <td><input name='chkTelnum' type='checkbox' id='chkTelnum' value='True' checked>" & vbCrLf
    Response.Write "                      联系电话</td>" & vbCrLf
    Response.Write "                    <td><input name='chkHouseAddress' type='checkbox' id='chkHouseAddress' value='True' checked>" & vbCrLf
    Response.Write "                      家庭地址</td>" & vbCrLf
    Response.Write "                    <td><input name='chkRemark' type='checkbox' id='chkRemark' value='True'>" & vbCrLf
    Response.Write "                      备注</td>" & vbCrLf
    Response.Write "                  </tr>" & vbCrLf
    Response.Write "                </table></td>" & vbCrLf
    Response.Write "            </tr>" & vbCrLf
    Response.Write "            <tr class='tdbg'>" & vbCrLf
    Response.Write "              <td align='right'><strong>请输入每页要打印的记录数：</strong></td>" & vbCrLf
    Response.Write "              <td colspan='2' align='left'><input name='PageSize' type='text' id='PageSize' value='30' size='4' maxlength='4'>" & vbCrLf
    Response.Write "                &nbsp;&nbsp;&nbsp;&nbsp;请根据页面设置中的纸张大小、页边距等实际情况设定记录数</td>" & vbCrLf
    Response.Write "            </tr>" & vbCrLf
    Response.Write "            <tr class='tdbg'> " & vbCrLf
    Response.Write "              <td colspan='3' align='center'> <p align='left'><font color='#FF0000'>&nbsp;&nbsp;&nbsp;&nbsp;记得一定要先用《如何用IE打印网页》一文中所介绍的方法进行页面设置</font><font color='#0000FF'>（推荐页面设置：纸张大小为A4张，页眉为空，页脚设为“&amp;b第&amp;p页 " & vbCrLf
    Response.Write "                  / 共&amp;P页&amp;b”，上、下边距为20毫米，左、右边距为15毫米）</font><font color='#FF0000'>，然后打印预览，满意后才开始打印呀。若出现一张表中内容打印在两张纸上的情况，请回到此页修改“每页要打印的记录数”，然后再重新打印预览。</font></p>" & vbCrLf
    Response.Write "                <p><input type='submit' name='Submit' value='打印预览'> " & vbCrLf
    Response.Write "              </p></td>" & vbCrLf
    Response.Write "            </tr>" & vbCrLf
    Response.Write "          </form>" & vbCrLf
    Response.Write "</TABLE>" & vbCrLf
    Response.Write "        <br>" & vbCrLf
    Response.Write "        <b><font color='#FF0000'>&nbsp;&nbsp;&nbsp;&nbsp;如果您还没有阅读<a href='Admin_StudentInfoManage.asp?Action=PrintGuide'>《如何用IE打印网页》</a>一文，那么请首先阅读它，因为本系统只是对查询的结果进行简单的版面调整，真正的打印功能还必须使用IE的打印功能来实现。</font><br>" & vbCrLf
    Response.Write "        <br>" & vbCrLf
    Response.Write "        <a href='Admin_StudentInfoManage.asp?Action=PrintGuide'>&nbsp;&nbsp;&nbsp;&nbsp;点此阅读《如何用IE打印网页》一文。</a> " & vbCrLf
    Response.Write "        <br>" & vbCrLf
    Response.Write "        <br>" & vbCrLf
End Sub

Sub ClassManage()

    Response.Write "    <br>" & vbCrLf
    Response.Write "    <table width='100%' class='border' border='0' cellspacing='1' cellpadding='4' align='center'>" & vbCrLf
    Response.Write "      <tr>" & vbCrLf
    Response.Write "        <td class='title' colspan='3'>" & vbCrLf
    Response.Write "          <div align='center'>" & vbCrLf
    Response.Write "           <b>班 级 管 理（添 加 新 班 级）</b>" & vbCrLf
    Response.Write "          </div>" & vbCrLf
    Response.Write "         </td>" & vbCrLf
    Response.Write "      </tr>" & vbCrLf
    Response.Write "      <form name='AddClass' onSubmit='return check()' action='Admin_StudentInfoManage.asp?Action=SaveClass' method='POST'  id='AddClass'>" & vbCrLf
    Response.Write "        <tr class='tdbg'>" & vbCrLf
    Response.Write "          <td width='20%' align='right'>" & vbCrLf
    Response.Write "           <strong>班级名称：</strong>" & vbCrLf
    Response.Write "          </td>" & vbCrLf
    Response.Write "          <td width='20%'>" & vbCrLf
    Response.Write "           <input name='ClassName' type='text' id='ClassName' size='10' maxlength='10'>" & vbCrLf
    Response.Write "" & vbCrLf
    Response.Write "              <script language='JavaScript'>document.AddClass.ClassName.focus();</script>" & vbCrLf
    Response.Write "" & vbCrLf
    Response.Write "" & vbCrLf
    Response.Write "          </td>" & vbCrLf
    Response.Write "          <td>例如：8班<br>" & vbCrLf
    Response.Write "    &nbsp;&nbsp;&nbsp;&nbsp;<font color='#FF0000'>每个年级的各班名称不能重复" & vbCrLf
    Response.Write "           </font> " & vbCrLf
    Response.Write "          </td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "        <tr class='tdbg'>" & vbCrLf
    Response.Write "          <td width='20%' align='right'>" & vbCrLf
    Response.Write "           <strong>所在年级：</strong>" & vbCrLf
    Response.Write "          </td>" & vbCrLf
    Response.Write "          <td width='20%'>" & vbCrLf
    Response.Write "           <select name='Grade'>" & vbCrLf
    Response.Write GetGrade_Option
    Response.Write "           </select>" & vbCrLf
    Response.Write "          </td>" & vbCrLf
    Response.Write "          <td>&nbsp;</td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "        <tr class='tdbg'>" & vbCrLf
    Response.Write "          <td colspan='3' align='center'>" & vbCrLf
    Response.Write "              <input type='submit' name='Submit' value='添  加'></td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "      </form>" & vbCrLf
    Response.Write "    </table>" & vbCrLf
    Response.Write "    </form>" & vbCrLf
    Response.Write "" & vbCrLf
    Response.Write "    <br>" & vbCrLf

    Call ShowClassManage
End Sub

Sub ModifyClass()
    Response.Write "    <br>" & vbCrLf
    Response.Write "    <table width='100%' class='border' border='0' cellspacing='1' cellpadding='4' align='center'>" & vbCrLf
    Response.Write "      <tr>" & vbCrLf
    Response.Write "        <td class='title' colspan='3'>" & vbCrLf
    Response.Write "          <div align='center'>" & vbCrLf
    Response.Write "          <b>修 改 班 级</b>" & vbCrLf
    Response.Write "          </div>" & vbCrLf
    Response.Write "          </td>" & vbCrLf
    Response.Write "      </tr>" & vbCrLf
    Response.Write "      <form name='AddClass' onSubmit='return check()' action='Admin_StudentInfoManage.asp?Action=SaveModifyClass' method='POST'>" & vbCrLf
    Response.Write "        <tr class='tdbg'>" & vbCrLf
    Response.Write "          <td width='20%' align='right'>" & vbCrLf
    Response.Write "          <strong>班级名称：</strong>" & vbCrLf
    Response.Write "          </td>" & vbCrLf
    Response.Write "          <td width='20%'>" & vbCrLf
    Response.Write "" & vbCrLf
    Response.Write "          <input name='ClassName' type='text' id='ClassName' size='10' maxlength='10' Value='" & Trim(Request("ClassName")) & "'>" & vbCrLf
    Response.Write "" & vbCrLf
    Response.Write "<script language='JavaScript'>document.AddClass.ClassName.focus();</script>" & vbCrLf
    Response.Write "" & vbCrLf
    Response.Write "              </td>" & vbCrLf
    Response.Write "          <td>例如：8班<br>" & vbCrLf
    Response.Write "    &nbsp;&nbsp;&nbsp;&nbsp;<font color='#FF0000'>每个年级的各班名称不能重复</font>" & vbCrLf
    Response.Write "    </td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "        <tr class='tdbg'>" & vbCrLf
    Response.Write "          <td width='20%' align='right'>" & vbCrLf
    Response.Write "          <strong>所在年级：</strong>" & vbCrLf
    Response.Write "          </td>" & vbCrLf
    Response.Write "          <td width='20%'>" & Trim(Request("GradeName")) & "</td>" & vbCrLf
    Response.Write "          <td>&nbsp;</td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "        <tr class='tdbg'>" & vbCrLf
    Response.Write "          <td colspan='3' align='center'>" & vbCrLf
    Response.Write "          <input type='hidden' name='id' value='" & Trim(Request("id")) & "'>" & vbCrLf
    Response.Write "          <input type='hidden' name='GradeID' value='" & Trim(Request("GradeID")) & "'>" & vbCrLf
    Response.Write "              <input type='submit' name='Submit' value='提  交'>" & vbCrLf
    Response.Write "              </td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "      </form>" & vbCrLf
    Response.Write "    </table>" & vbCrLf
    Response.Write "    </form>" & vbCrLf
    Response.Write "" & vbCrLf
    Response.Write "    <br>" & vbCrLf
        
    Call ShowClassManage
End Sub

Sub ShowClassManage()
    Response.Write "    <strong>已有的班级：</strong>" & vbCrLf
    Response.Write "" & vbCrLf
    Response.Write "    <table width='100%' border='0' cellspacing='0' cellpadding='0'><tr>" & vbCrLf
    Response.Write "" & vbCrLf
    Dim rs, sql
    Set rs = Server.CreateObject("adodb.recordset")
    sql = "select * from Grade order by OrderID asc"
    rs.Open sql, Conn_Sdms, 1, 1
    Dim i
    i = 0
    Do While Not rs.EOF
        Response.Write "          <td align='center' valign='top'>" & vbCrLf
        Response.Write "            <table width='100%' border='1' cellspacing='3' align='left' cellpadding='3'>" & vbCrLf
        Response.Write "              <tr valign='middle' class='title'>  " & vbCrLf
        Response.Write "                <td><strong>" & rs("GradeName") & "</strong></td>" & vbCrLf
        Response.Write "              </tr>" & vbCrLf
        Response.Write "              <tr align='center' valign='top'> " & vbCrLf
        Response.Write "                <td><table width='100%' border='0' cellspacing='2' cellpadding='0'>" & vbCrLf
        Response.Write "                      <tr align='center' valign='middle'> " & vbCrLf
        Response.Write "                        <td>班级名称</td>" & vbCrLf
        Response.Write "                        <td>常规操作</td>" & vbCrLf
        Response.Write "                        <td>排序操作</td>" & vbCrLf
        Response.Write "                      </tr>" & vbCrLf
        Response.Write "" & vbCrLf
        Dim rsClass, sqlClass
        Set rsClass = Server.CreateObject("adodb.recordset")
        sqlClass = "select * from Class where GradeID=" & rs("GradeID") & " order by OrderID asc"
        rsClass.Open sqlClass, Conn_Sdms, 1, 1
        Do While Not rsClass.EOF
            Response.Write "    <tr class='tdbg' onmouseout=""this.className='tdbg'"" onmouseover=""this.className='tdbgmouseover'"">" & vbCrLf
            'Response.Write "      <td align='center'>" & rsClass("ClassID") & "</td>" & vbCrLf
            Response.Write "      <td align='center'>" & rsClass("ClassName") & "</td>" & vbCrLf
            Response.Write "      <td align='center'><a href='Admin_StudentInfoManage.asp?Action=ModifyClass&ClassName=" & rsClass("ClassName") & "&id=" & rsClass("ClassID") & "&GradeName=" & rs("GradeName") & "&GradeID=" & rsClass("GradeID") & " '>修改</a>&nbsp;&nbsp;" & vbCrLf
            Response.Write "<a href='Admin_StudentInfoManage.asp?Action=DelClass&id=" & rsClass("ClassID") & "' onClick=""return confirm('确定要删除此班级吗？本操作将同时删除此班级里的学生信息！！');"">删除</a>&nbsp;" & vbCrLf
            Response.Write "                </td>" & vbCrLf

            Response.Write "<form name='orderform' method='post' action='Admin_StudentInfoManage.asp'>"
            Response.Write "    <td width='100' align='center'>      <input name='OrderID' type='text' id='OrderID' value='" & rsClass("OrderID") & "' size='4' maxlength='4' style='text-align:center '>"
            Response.Write "      <input name='ClassID' type='hidden' id='ClassID' value='" & rsClass("ClassID") & "'>"
            Response.Write "    <input type='submit' name='Submit' value='修改'>"
            Response.Write "    <input name='Action' type='hidden' id='Action' value='OrderClass'></td></form>"
            
            Response.Write "              </tr>" & vbCrLf
            rsClass.MoveNext
        Loop
        Set rsClass = Nothing
        Response.Write "                    </table></td>" & vbCrLf
        Response.Write "                  </tr>" & vbCrLf
        Response.Write "                </table></td>" & vbCrLf
        Response.Write "" & vbCrLf
        rs.MoveNext
        i = i + 1
        If i Mod 3 = 0 Then Response.Write "</tr><tr>"
    Loop
    Set rs = Nothing

    Response.Write "</table>"
End Sub

Sub SaveClass()
    
    Dim sql, rs, GradeID, ClassName
    ClassName = Trim(Request("ClassName"))
    GradeID = Trim(Request("Grade"))
    If GradeID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>请指定班级ID</li>"
    Else
        GradeID = PE_CLng(GradeID)
    End If
    If ClassName = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>请指定班级ID</li>"
    Else
        ClassName = ReplaceBadChar(ClassName)
    End If
    If FoundErr = True Then Exit Sub
    sql = "Select ClassName From Class Where ClassName='" & ClassName & "' And GradeID=" & GradeID & ""
    Set rs = Server.CreateObject("ADODB.Recordset")
    rs.Open sql, Conn_Sdms, 1, 3
    If Not rs.EOF Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>班级名称与数据库中已有记录重复！</li>"
    Else
        Conn_Sdms.Execute "insert into Class (ClassName,GradeID) values('" & ClassName & "'," & GradeID & ")"
        Response.Redirect "Admin_StudentInfoManage.asp?Action=ClassManage"
    End If
    Set rs = Nothing


End Sub

Sub SaveModifyClass()
    
    Dim sql, rs, ClassID, ClassName, ID, GradeID
    ClassName = Trim(Request("ClassName"))
    If ClassName = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>请指定班级ID</li>"
    Else
        ClassName = ReplaceBadChar(ClassName)
    End If
    If Request("id") = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>请指定班级ID</li>"
    End If
    If Request("GradeID") = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>年级ID不能为空</li>"
    End If
    If FoundErr = True Then Exit Sub
    GradeID = PE_CLng(Trim(Request("GradeID")))
    sql = "Select ClassName From Class Where ClassName='" & ClassName & "' And GradeID=" & GradeID & ""
    Set rs = Server.CreateObject("ADODB.Recordset")
    rs.Open sql, Conn_Sdms, 1, 3
    If Not rs.EOF Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>班级名称与数据库中已有记录重复！</li>"
    Else
        Conn_Sdms.Execute "update Class set ClassName='" & ClassName & "' where ClassID=" & PE_CLng(Trim(Request("id")))
        Response.Redirect "Admin_StudentInfoManage.asp?Action=ClassManage"
    End If
    Set rs = Nothing
    
End Sub

Sub DelClass()
    If Request("id") = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>请指定班级ID</li>"
    Else
        
        Conn_Sdms.Execute "delete from Class where ClassID=" & PE_CLng(Request("id"))
        Conn_Sdms.Execute "delete from StudentInfo where ClassID=" & PE_CLng(Request("id"))
            
        Response.Redirect "Admin_StudentInfoManage.asp?Action=ClassManage"
    End If
End Sub

Sub OrderClass()
    Dim ClassID, OrderID
    ClassID = Trim(Request("ClassID"))
    OrderID = Trim(Request("OrderID"))
    If ClassID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>请指定班级ID！</li>"
    Else
        ClassID = PE_CLng(ClassID)
    End If
    If OrderID = "" Or IsNumeric(OrderID) = 0 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>指定排序顺序ID有误！</li>"
    Else
        OrderID = PE_CLng(OrderID)
    End If
    If FoundErr = True Then Exit Sub
    
    Conn_Sdms.Execute ("update Class set OrderID=" & OrderID & " where ClassID=" & ClassID & "")
    
    Response.Redirect "Admin_StudentInfoManage.asp?Action=ClassManage"
End Sub

Sub SaveGrade()

    Dim sql, rs, GradeID, GradeName
    GradeName = Trim(Request("GradeName"))
    If GradeName = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>请指定年级名称！</li>"
    Else
        GradeName = ReplaceBadChar(GradeName)
    End If
    If FoundErr = True Then Exit Sub
    sql = "Select GradeName From Grade Where GradeName='" & GradeName & "'"
    Set rs = Server.CreateObject("ADODB.Recordset")
    rs.Open sql, Conn_Sdms, 1, 3
    If Not rs.EOF Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>年级名称与数据库中已有记录重复！</li>"
    Else
        Conn_Sdms.Execute "insert into Grade (GradeName) values('" & GradeName & "')"
        Response.Redirect "Admin_StudentInfoManage.asp?Action=GradeManage"
    End If
    Set rs = Nothing

End Sub

Sub ModifyGrade()
    Response.Write "    <script language=""JavaScript"" type=""text/JavaScript"">" & vbCrLf
    Response.Write "    function Modifycheck()" & vbCrLf
    Response.Write "    {" & vbCrLf
    Response.Write "      if(document.ModifyGrade.GradeName.value=="""")" & vbCrLf
    Response.Write "      {" & vbCrLf
    Response.Write "        alert(""你还没有填年级名称！"");" & vbCrLf
    Response.Write "        document.ModifyGrade.GradeName.focus();" & vbCrLf
    Response.Write "        return false;" & vbCrLf
    Response.Write "      }" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "    </script>" & vbCrLf

    Response.Write "    <br>" & vbCrLf
    Response.Write "    <table width='100%' class='border' border='0' cellspacing='1' cellpadding='4' align='center'>" & vbCrLf
    Response.Write "      <tr>" & vbCrLf
    Response.Write "        <td class='title' colspan='3'>" & vbCrLf
    Response.Write "          <div align='center'>" & vbCrLf
    Response.Write "          <b>修 改 年 级</b>" & vbCrLf
    Response.Write "          </div>" & vbCrLf
    Response.Write "          </td>" & vbCrLf
    Response.Write "      </tr>" & vbCrLf
    Response.Write "      <form name='ModifyGrade' onSubmit='return Modifycheck()' action='Admin_StudentInfoManage.asp?Action=SaveModifyGrade' method='POST'  id='ModifyGrade'>" & vbCrLf
    Response.Write "        <tr class='tdbg'>" & vbCrLf
    Response.Write "          <td width='20%' align='right'>" & vbCrLf
    Response.Write "          <strong>年级名称：</strong>" & vbCrLf
    Response.Write "          </td>" & vbCrLf
    Response.Write "          <td width='20%'>" & vbCrLf
    Response.Write "          <input name='GradeName' type='text' id='GradeName' size='12' maxlength='12' value='" & Trim(Request("GradeName")) & "'>" & vbCrLf
    Response.Write "              <script language='JavaScript'>document.ModifyGrade.GradeName.focus();</script>" & vbCrLf
    Response.Write "              </td>" & vbCrLf
    Response.Write "          <td>例如：初一年级<br>" & vbCrLf
    Response.Write "    &nbsp;&nbsp;&nbsp;&nbsp;<font color='#FF0000'>每个年级的名称不能重复</font>" & vbCrLf
    Response.Write "    </td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "        <tr class='tdbg'>" & vbCrLf
    Response.Write "          <td colspan='3' align='center'>" & vbCrLf
    Response.Write "          <input type='hidden' name='id' value='" & Trim(Request("id")) & "'>" & vbCrLf
    Response.Write "          <input type='submit' name='Submit' value='提  交'>" & vbCrLf
    Response.Write "          </td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "      </form>" & vbCrLf
    Response.Write "    </table>" & vbCrLf
    Response.Write "    </form>" & vbCrLf
    Response.Write "    <br>" & vbCrLf

    Call ShowGradeManage
End Sub

Sub ShowGradeManage()

    Response.Write "    <strong>已有的年级：</strong>" & vbCrLf
    Response.Write "    <table width='400' border='1' align='center' cellpadding='3' cellspacing='3'>" & vbCrLf
    Response.Write "              <tr valign='middle' class='title'>" & vbCrLf
    Response.Write "              <td>" & vbCrLf
    Response.Write "              <strong>已有的年级管理</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>" & vbCrLf
    Response.Write "                <a href='Admin_StudentInfoManage.asp?Action=UpdateGrade'>年级数据自动升级</a>" & vbCrLf
    Response.Write "                </strong>" & vbCrLf
    Response.Write "                </td>" & vbCrLf
    Response.Write "              </tr>" & vbCrLf
    Response.Write "              <tr align='center' valign='top'> " & vbCrLf
    Response.Write "                <td><table width='100%' border='0' cellspacing='2' cellpadding='0'>" & vbCrLf
    Response.Write "                      <tr align='center' valign='middle'> " & vbCrLf
    Response.Write "                        <td>年级名称</td>" & vbCrLf
    Response.Write "                        <td>常规操作</td>" & vbCrLf
    Response.Write "                        <td>排序操作</td>" & vbCrLf
    Response.Write "                      </tr>" & vbCrLf
    Response.Write "" & vbCrLf

    Dim rs, sql
    Set rs = Server.CreateObject("adodb.recordset")
    sql = "select * from Grade order by OrderID asc"
    rs.Open sql, Conn_Sdms, 1, 1
    Do While Not rs.EOF
        Response.Write "    <tr class='tdbg' onmouseout=""this.className='tdbg'"" onmouseover=""this.className='tdbgmouseover'"">" & vbCrLf
        'Response.Write "      <td style='cursor:hand' align='center'>" & rs("GradeID") & "</td>" & vbCrLf
        Response.Write "      <td align='center'>" & rs("GradeName") & "</td>" & vbCrLf
        Response.Write "      <td align='center'><a href='Admin_StudentInfoManage.asp?Action=ModifyGrade&GradeName=" & rs("GradeName") & "&id=" & rs("GradeID") & "'>修改</a>&nbsp;&nbsp;" & vbCrLf
        If rs("Disabled") = True Then
            Response.Write "<a href='Admin_StudentInfoManage.asp?Action=UnDisabledGrade&GradeID=" & rs("GradeID") & "'>启用</a>&nbsp;&nbsp;"
        Else
            Response.Write "<a href='Admin_StudentInfoManage.asp?Action=DisabledGrade&GradeID=" & rs("GradeID") & "'>禁用</a>&nbsp;&nbsp;"
        End If
        Response.Write "<a href='Admin_StudentInfoManage.asp?Action=DelGrade&id=" & rs("GradeID") & "' onClick=""return confirm('确定要删除此年级吗？本操作将同时删除此年级下的班级以及班级里的学生信息！！');"">删除</a>&nbsp;" & vbCrLf
        Response.Write "                </td>" & vbCrLf

        Response.Write "<form name='orderform' method='post' action='Admin_StudentInfoManage.asp'>"
        Response.Write "    <td width='100' align='center'>      <input name='OrderID' type='text' id='OrderID' value='" & rs("OrderID") & "' size='4' maxlength='4' style='text-align:center '>"
        Response.Write "      <input name='GradeID' type='hidden' id='GradeID' value='" & rs("GradeID") & "'>"
        Response.Write "    <input type='submit' name='Submit' value='修改'>"
        Response.Write "    <input name='Action' type='hidden' id='Action' value='OrderGrade'></td></form>"
        
        Response.Write "              </tr>" & vbCrLf
        rs.MoveNext
    Loop
    Set rs = Nothing

    Response.Write "                  </table></td>" & vbCrLf
    Response.Write "              </tr>" & vbCrLf
    Response.Write "    </table>" & vbCrLf
    Response.Write "" & vbCrLf

End Sub

Sub SaveModifyGrade()

    Dim sql, rs, GradeID, GradeName
    GradeName = Trim(Request("GradeName"))
    If GradeName = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>请指定年级名称！</li>"
    Else
        GradeName = ReplaceBadChar(GradeName)
    End If
    GradeID = Trim(Request("id"))
    If GradeID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>请指定年级ID！</li>"
    Else
        GradeID = CLng(GradeID)
    End If
    If FoundErr = True Then Exit Sub
    sql = "Select GradeName From Grade Where GradeName='" & GradeName & "'"
    Set rs = Server.CreateObject("ADODB.Recordset")
    rs.Open sql, Conn_Sdms, 1, 3
    If Not rs.EOF Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>年级名称与数据库中已有记录重复！</li>"
    Else
        Conn_Sdms.Execute "update Grade set GradeName='" & GradeName & "' where GradeID=" & GradeID
        Response.Redirect "Admin_StudentInfoManage.asp?Action=GradeManage"
    End If
    Set rs = Nothing

End Sub

Sub DisabledGrade(ActionType)
    Dim GradeID
    GradeID = Trim(Request("GradeID"))
    If GradeID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>请指定年级ID</li>"
    Else
        GradeID = CLng(GradeID)
    End If
    If FoundErr = True Then
        Exit Sub
    End If
    
    If ActionType = 0 Then
        Conn_Sdms.Execute ("update Grade set Disabled=True where GradeID=" & GradeID)
    Else
        Conn_Sdms.Execute ("update Grade set Disabled=False where GradeID=" & GradeID)
    End If

    Response.Redirect "Admin_StudentInfoManage.asp?Action=GradeManage"
End Sub

Sub DelGrade()
    Dim GradeID
    GradeID = Trim(Request("id"))
    If GradeID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>请指定年级ID！</li>"
    Else
        GradeID = CLng(GradeID)
    End If
    If FoundErr = True Then Exit Sub

    Conn_Sdms.Execute "delete from Grade where GradeID=" & GradeID
    Conn_Sdms.Execute "delete from Class where GradeID=" & GradeID
    Conn_Sdms.Execute "delete from StudentInfo where GradeID=" & GradeID

    Response.Redirect "Admin_StudentInfoManage.asp?Action=GradeManage"
End Sub

Sub OrderGrade()
    Dim GradeID, OrderID
    GradeID = Trim(Request("GradeID"))
    OrderID = Trim(Request("OrderID"))
    If GradeID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>请指定年级ID！</li>"
    Else
        GradeID = CLng(GradeID)
    End If
    If OrderID = "" Or IsNumeric(OrderID) = 0 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>指定排序顺序ID有误！</li>"
    Else
        OrderID = CLng(OrderID)
    End If
    If FoundErr = True Then Exit Sub

    Conn_Sdms.Execute ("update Grade set OrderID=" & OrderID & " where GradeID=" & GradeID & "")

    Response.Redirect "Admin_StudentInfoManage.asp?Action=GradeManage"
End Sub

Sub GradeManage()
    Response.Write "    <script language=""JavaScript"" type=""text/JavaScript"">" & vbCrLf
    Response.Write "    function check()" & vbCrLf
    Response.Write "    {" & vbCrLf
    Response.Write "      if(document.AddGrade.GradeName.value=="""")" & vbCrLf
    Response.Write "      {" & vbCrLf
    Response.Write "        alert(""你还没有填年级名称！"");" & vbCrLf
    Response.Write "        document.AddGrade.GradeName.focus();" & vbCrLf
    Response.Write "        return false;" & vbCrLf
    Response.Write "      }" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "    </script>" & vbCrLf
    Response.Write "" & vbCrLf
    Response.Write "    <br>" & vbCrLf
    Response.Write "    <table width='100%' class='border' border='0' cellspacing='1' cellpadding='4' align='center'>" & vbCrLf
    Response.Write "      <tr>" & vbCrLf
    Response.Write "        <td class='title' colspan='3'>" & vbCrLf
    Response.Write "          <div align='center'>" & vbCrLf
    Response.Write "          <b>年 级 管 理（添 加 新 年 级）</b>" & vbCrLf
    Response.Write "          </div>" & vbCrLf
    Response.Write "          </td>" & vbCrLf
    Response.Write "      </tr>" & vbCrLf
    Response.Write "      <form name='AddGrade' onSubmit='return check()' action='Admin_StudentInfoManage.asp?Action=SaveGrade' method='POST'  id='AddGrade'>" & vbCrLf
    Response.Write "        <tr class='tdbg'>" & vbCrLf
    Response.Write "          <td width='20%' align='right'>" & vbCrLf
    Response.Write "          <strong>年级名称：</strong>" & vbCrLf
    Response.Write "          </td>" & vbCrLf
    Response.Write "          <td width='20%'>" & vbCrLf
    Response.Write "          <input name='GradeName' type='text' id='GradeName' size='10' maxlength='10'>" & vbCrLf
    Response.Write "              <script language='JavaScript'>document.AddGrade.GradeName.focus();</script>" & vbCrLf
    Response.Write "              </td>" & vbCrLf
    Response.Write "          <td>例如：初一年级<br>" & vbCrLf
    Response.Write "    &nbsp;&nbsp;&nbsp;&nbsp;<font color='#FF0000'>每个年级的名称不能重复</font>" & vbCrLf
    Response.Write "     </td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "        <tr class='tdbg'>" & vbCrLf
    Response.Write "          <td colspan='3' align='center'>" & vbCrLf
    Response.Write "          <input type='submit' name='Submit' value='添  加'>" & vbCrLf
    Response.Write "          </td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "      </form>" & vbCrLf
    Response.Write "    </table>" & vbCrLf
    Response.Write "    </form>" & vbCrLf
    Response.Write "    <br>" & vbCrLf
    Response.Write "" & vbCrLf

    Call ShowGradeManage
End Sub

Sub UpdateGrade()
    Response.Write "<script language = 'JavaScript'>" & vbCrLf
    Response.Write "function CheckForm(){" & vbCrLf
    Response.Write "  if(confirm('确实要进行年级数据自动升级吗？'))" & vbCrLf
    Response.Write "  {" & vbCrLf
    Response.Write "    return True;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  else" & vbCrLf
    Response.Write "  {" & vbCrLf
    Response.Write "    return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "</script>" & vbCrLf
    Response.Write "<br>" & vbCrLf
    Response.Write "<table width='100%' border='0' cellspacing='1' cellpadding='2' class='border'>" & vbCrLf
    Response.Write "  <tr class='title'>" & vbCrLf
    Response.Write "    <td height='22' align='center'><strong> 年 级 数 据 自 动 升 级 </strong></td>" & vbCrLf
    Response.Write "  </tr>" & vbCrLf
    Response.Write "  <tr class='tdbg'>" & vbCrLf
    Response.Write "    <td height='150'>" & vbCrLf
    Response.Write "      <form name='myform' method='post' action='Admin_StudentInfoManage.asp' onSubmit='return CheckForm();'>" & vbCrLf
    Response.Write "        <p align='center'>" & vbCrLf
    Response.Write "        <font color='#FF0000'><b>请慎用此功能！！</b></font>" & vbCrLf
    Response.Write "        <br>此操作将自动升级数据库中的年级表数据，用于学校开学之初，最高年级毕业，最低年级招收新同学年级数据自动升级使用。" & vbCrLf
    Response.Write "        </p>" & vbCrLf
    Response.Write "        <p align='center'>" & vbCrLf
    Response.Write "        <input name='Action' type='hidden' id='Action' value='DoUpdateGrade'>" & vbCrLf
    Response.Write "        <input type='submit' name='Submit' value=' 自动升级 '>" & vbCrLf
    Response.Write "        </p>" & vbCrLf
    Response.Write "      </form>" & vbCrLf
    Response.Write "    </td>" & vbCrLf
    Response.Write "  </tr>" & vbCrLf
    Response.Write "</table>" & vbCrLf
End Sub

Sub DoUpdateGrade()
    Dim FirstGrade, FirstGradeName, FirstGradeOrderID
    Set FirstGrade = Conn_Sdms.Execute("select top 1 GradeName,OrderID from Grade where Disabled=False order by orderID asc")
    FirstGradeName = FirstGrade(0)
    FirstGradeOrderID = FirstGrade(1)
    Set FirstGrade = Nothing

    Dim rsKey, sqlKey, arraytemp, GradeNum, i
    Set rsKey = Server.CreateObject("Adodb.RecordSet")
    sqlKey = "select GradeID,GradeName from Grade where Disabled=False order by orderID asc"
    rsKey.Open sqlKey, Conn_Sdms, 1, 1
    If Not (rsKey.BOF And rsKey.EOF) Then
        arraytemp = rsKey.GetRows
    End If
    Set rsKey = Nothing

    GradeNum = UBound(arraytemp, 2)
    For i = 0 To GradeNum - 1
        Conn_Sdms.Execute ("update Grade set GradeName='" & arraytemp(1, i + 1) & "',OrderID=OrderID+1 where GradeID=" & arraytemp(0, i) & "")
    Next
    Conn_Sdms.Execute ("update Grade set GradeName='" & arraytemp(1, GradeNum) & "(已毕业)',OrderID=OrderID+1,Disabled=True where GradeID=" & arraytemp(0, GradeNum) & "")
    Conn_Sdms.Execute ("insert into Grade(GradeName,OrderID,Disabled) Values('" & FirstGradeName & "'," & FirstGradeOrderID & ",False)")

    Call WriteSuccessMsg("年级数据自动升级成功！", ComeUrl)
End Sub

Function WriteSuccessMsg(sSuccessMsg, sComeUrl)
    Dim strMsg
    strMsg = strMsg & "<html><head><title>成功信息</title><meta http-equiv='Content-Type' content='text/html; charset=gb2312'>" & vbCrLf
    strMsg = strMsg & "<link href='images/Style.css' rel='stylesheet' type='text/css'></head><body><br><br>" & vbCrLf
    strMsg = strMsg & "<table cellpadding=2 cellspacing=1 border=0 width=400 class='border' align=center>" & vbCrLf
    strMsg = strMsg & "  <tr align='center' class='title'><td height='22'><strong>恭喜你！</strong></td></tr>" & vbCrLf
    strMsg = strMsg & "  <tr class='tdbg'><td height='100' valign='top'><br>" & sSuccessMsg & "</td></tr>" & vbCrLf
    strMsg = strMsg & "  <tr align='center' class='tdbg'><td>"
    If sComeUrl <> "" Then
        strMsg = strMsg & "<a href='" & sComeUrl & "'>&lt;&lt; 返回上一页</a>"
    Else
        strMsg = strMsg & "<a href='javascript:window.close();'>【关闭】</a>"
    End If
    strMsg = strMsg & "</td></tr>" & vbCrLf
    strMsg = strMsg & "</table>" & vbCrLf
    strMsg = strMsg & "</body></html>" & vbCrLf
    WriteSuccessMsg = strMsg
End Function

Sub PrintGuide()
    Response.Write "<table width='100%' border=0 align='center' cellPadding=0 cellSpacing=0>" & vbCrLf
    Response.Write "  <TBODY>" & vbCrLf
    Response.Write "    <TR> " & vbCrLf
    Response.Write "       " & vbCrLf
    Response.Write "       " & vbCrLf
    Response.Write "      <td width='10' ></td>" & vbCrLf
    Response.Write "      <TD height='500' valign='top' ><p align='center'><br>" & vbCrLf
    Response.Write "          <strong><font size='5'>如何用IE打印网页</font></strong></p>" & vbCrLf
    Response.Write "        <p>&nbsp;&nbsp;&nbsp;&nbsp;Internet Explorer（简称IE）5.0以上版本强大的打印及打印预览功能。本文就向大家介绍如何用IE来打印网页。（谁？谁？谁在扔西红柿？下面一片嘘声：这还用得着你讲呀？！）咳咳咳，是的是的，在IE中打印网页实在是太简单不过了。只需点一下工具栏上“打印”按钮就可将当前网页打印出来。如下图所示：</p>" & vbCrLf
    Response.Write "        <p align='center'><img src='images/guide1.JPG' width='600' height='100'></p>" & vbCrLf
    Response.Write "        <p>&nbsp;&nbsp;&nbsp;&nbsp;不过，你这样打出来的效果怎么样呢？我就不敢说了。我今天要和大家讲的就是一些打印方面的设置参数。如何大家把这些参数设置好，你就会发现IE的打印功能快追得上Word了。今后你打印网页时就可以想怎么打就怎么打了。好，闲话少说，现在就跟我来一起看看怎么样设置IE的打印参数。</p>" & vbCrLf
    Response.Write "        <p>&nbsp;&nbsp;&nbsp;&nbsp;我们以下图要打印的学生名单（《学生学籍管理系统MX》查询结果网页）为例，讲解如何设置这些打印参数：</p>" & vbCrLf
    Response.Write "        <p align='center'><img src='images/guide2.JPG' width='400' height='298'></p>" & vbCrLf
    Response.Write "        <p align='left'>&nbsp;&nbsp;&nbsp;&nbsp;假如我们直接点工具栏的“打印”按钮或点“文件”菜单中的“打印”进行打印这个网页的话，就会打印出很多不必要的信息。所以在打印前我们应先用IE5新增的“打印预览”功能查看当前网页的实际打印效果。如下图所示：</p>" & vbCrLf
    Response.Write "        <p align='center'><img src='images/guide3.JPG' width='600' height='254'></p>" & vbCrLf
    Response.Write "        <p align='left'>&nbsp;&nbsp;&nbsp;&nbsp;在如下图所示的“打印预览”对话框中，我们可以看到，网页标题、网页的URL地址及打印日期等我们所不需要的信息也被打印出来了。而页码又在右上角，能不能把它移到其他位置（如我们常见的右下角）呢？</p>" & vbCrLf
    Response.Write "        <p align='center'><img src='images/guide4.JPG' width='600' height='274'><br>" & vbCrLf
    Response.Write "          <img src='images/guide5.JPG' width='600' height='274'></p>" & vbCrLf
    Response.Write "        <p align='left'>&nbsp;&nbsp;&nbsp;&nbsp;能不能按照我们所想要的样式来打印网页呢？当然可以。一切就在“页面设置”中。</p>" & vbCrLf
    Response.Write "        <p align='center'><img src='images/guide6.JPG' width='600' height='255'></p>" & vbCrLf
    Response.Write "        <p align='left'>&nbsp;&nbsp;&nbsp;&nbsp;弹出如下图所示的“页面设置”对话框，所有的秘密都在这里！</p>" & vbCrLf
    Response.Write "        <p align='center'><img src='images/guide7.JPG' width='393' height='382'></p>" & vbCrLf
    Response.Write "        <p align='left'>&nbsp;&nbsp;&nbsp;&nbsp;原来，IE自动给我们在页眉和页脚处加上了这些不必要的打印信息。如果我们不想要任何页眉和页脚的话，直接删除它们就行了。：-）大部分时候我都是这样做的。但如果你想自定义页眉和页脚的时候，该怎么做呢？上面的那些“&amp;w&amp;b&amp;p”等等究竟表示什么意思呀？给你个表格就知道了。 " & vbCrLf
    Response.Write "        <TABLE width='80%' border='1' align='center'>" & vbCrLf
    Response.Write "          <TR> " & vbCrLf
    Response.Write "            <TH>符号</TH>" & vbCrLf
    Response.Write "            <TH>含义</TH>" & vbCrLf
    Response.Write "          </TR>" & vbCrLf
    Response.Write "          <TR> " & vbCrLf
    Response.Write "            <TD>&amp;w</TD>" & vbCrLf
    Response.Write "            <TD>网页标题</TD>" & vbCrLf
    Response.Write "          </TR>" & vbCrLf
    Response.Write "          <TR> " & vbCrLf
    Response.Write "            <TD>&amp;u</TD>" & vbCrLf
    Response.Write "            <TD>网页地址 (URL)</TD>" & vbCrLf
    Response.Write "          </TR>" & vbCrLf
    Response.Write "          <TR> " & vbCrLf
    Response.Write "            <TD>&amp;d</TD>" & vbCrLf
    Response.Write "            <TD>短日期格式（由“控制面板”中的“区域设置”指定）</TD>" & vbCrLf
    Response.Write "          </TR>" & vbCrLf
    Response.Write "          <TR> " & vbCrLf
    Response.Write "            <TD>&amp;D</TD>" & vbCrLf
    Response.Write "            <TD>长日期格式（由“控制面板”中的“区域设置”指定）</TD>" & vbCrLf
    Response.Write "          </TR>" & vbCrLf
    Response.Write "          <TR> " & vbCrLf
    Response.Write "            <TD>&amp;t</TD>" & vbCrLf
    Response.Write "            <TD>由“控制面板”中的“区域设置”指定的时间格式</TD>" & vbCrLf
    Response.Write "          </TR>" & vbCrLf
    Response.Write "          <TR> " & vbCrLf
    Response.Write "            <TD>&amp;T</TD>" & vbCrLf
    Response.Write "            <TD>24 小时时间格式</TD>" & vbCrLf
    Response.Write "          </TR>" & vbCrLf
    Response.Write "          <TR> " & vbCrLf
    Response.Write "            <TD>&amp;p</TD>" & vbCrLf
    Response.Write "            <TD>当前页码</TD>" & vbCrLf
    Response.Write "          </TR>" & vbCrLf
    Response.Write "          <TR> " & vbCrLf
    Response.Write "            <TD>&amp;P</TD>" & vbCrLf
    Response.Write "            <TD>总页数</TD>" & vbCrLf
    Response.Write "          </TR>" & vbCrLf
    Response.Write "          <TR> " & vbCrLf
    Response.Write "            <TD>&amp;b</TD>" & vbCrLf
    Response.Write "            <TD>文本右对齐（请把要右对齐的文字放在“&amp;b”之后）</TD>" & vbCrLf
    Response.Write "          </TR>" & vbCrLf
    Response.Write "          <TR> " & vbCrLf
    Response.Write "            <TD>&amp;b&amp;b</TD>" & vbCrLf
    Response.Write "            <TD>文字居中（请把要居中的文字放在“&amp;b”和“&amp;b” 之间）</TD>" & vbCrLf
    Response.Write "          </TR>" & vbCrLf
    Response.Write "          <TR> " & vbCrLf
    Response.Write "            <TD>&amp;&amp;</TD>" & vbCrLf
    Response.Write "            <TD>单个 &amp; 号 (&amp;)</TD>" & vbCrLf
    Response.Write "          </TR>" & vbCrLf
    Response.Write "        </TABLE>" & vbCrLf
    Response.Write "        <p>注：1、这些符号可以与文字组合使用，如本教程中的“页码，&amp;p/&amp;P”。<br>" & vbCrLf
    Response.Write "          &nbsp;&nbsp;&nbsp;&nbsp;2、页眉和页脚默认是左对齐的，所以IE只提供了右对齐和居中的设置符号。<br>" & vbCrLf
    Response.Write "          &nbsp;&nbsp;&nbsp;&nbsp;3、推荐给大家一种设置方法：页眉为空，页脚设为“&amp;b第 &amp;p 页 / 共 " & vbCrLf
    Response.Write "          &amp;P 页&amp;b”，打印效果为在页脚居中显示“第 1 页 / 共 4 页”的效果。</p>" & vbCrLf
    Response.Write "        <p>&nbsp;&nbsp;&nbsp;&nbsp;知道了上面的知识，你就可以打印了。但有时你会发现，网页中的一些图像在打印时不见了。Why？为什么会这样？别着急，IE的默认设置是不打印网页的背景颜色和图像的。您只需进入IE的Internet选项将它选中（打上勾）就行了。具体操作方法是：点IE的主菜单中的“工具”——“Internet选项”——再在弹出的对话框中占击“高级”选项卡，找到“打印背景颜色和图像”一项。如下图所示：</p>" & vbCrLf
    Response.Write "        <p align='center'><img src='images/guide8.JPG' width='350' height='369'></p>" & vbCrLf
    Response.Write "        <p align='left'>&nbsp;&nbsp;&nbsp;&nbsp;然后将上图中红色圈住的选项打上勾，再点“确定”就OK了。</p>" & vbCrLf
    Response.Write "        <p align='left'>&nbsp;&nbsp;&nbsp;&nbsp;至此，我们就完成了对IE的打印设置。接下来，只要我们没有关闭IE，我们就可以一直使用上述设置（最后一项“打印背景颜色和图像”的更改始终有效）进行打印。打印前一般先进行打印预览，效果满意后再开始打印。<br>" & vbCrLf
    Response.Write "          <br>" & vbCrLf
    Response.Write "        </p>" & vbCrLf
    Response.Write "      </td>" & vbCrLf
    Response.Write "       " & vbCrLf
    Response.Write "    </TR> " & vbCrLf
    Response.Write "  </TBODY>" & vbCrLf
    Response.Write "</TABLE>" & vbCrLf
End Sub


Sub InfoPrint2()
    Response.Write "<HTML>" & vbCrLf
    Response.Write "<HEAD>" & vbCrLf
    Response.Write "<TITLE>学生信息打印预览</TITLE>" & vbCrLf
    Response.Write "<META http-equiv=Content-Type content='text/html; charset=gb2312'>" & vbCrLf
    Response.Write "<META content='MSHTML 6.00.2600.0' Name=GENERATOR>" & vbCrLf
    Response.Write "<style type='text/css'>" & vbCrLf
    Response.Write "<!--" & vbCrLf
    Response.Write "TABLE {" & vbCrLf
    Response.Write "    font-size: 12px;" & vbCrLf
    Response.Write "    line-height: 15px;" & vbCrLf
    Response.Write "    text-decoration: none;" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "-->" & vbCrLf
    Response.Write "</style>" & vbCrLf
    Response.Write "<script language=""JavaScript"" type=""text/JavaScript"">" & vbCrLf
    Response.Write "<!--" & vbCrLf
    Response.Write "function MM_reloadPage(init) { " & vbCrLf
    Response.Write "  if (init==true) with (navigator) {if ((appName==""Netscape"")&&(parseInt(appVersion)==4)) {" & vbCrLf
    Response.Write "    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}" & vbCrLf
    Response.Write "  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "MM_reloadPage(true);" & vbCrLf
    Response.Write "</script>" & vbCrLf
    Response.Write "" & vbCrLf
    Response.Write "</HEAD>" & vbCrLf
    Response.Write "<BODY text=#000000 bgColor=#ffffff leftMargin=5 topMargin=5>" & vbCrLf

    Dim Recordset1__MMColParam, strStudentNum, strName, strGrade, strClass, strTitle
    Dim Repeat1__numRows, intPageSize, Recordset1, Recordset1Sql

    intPageSize = PE_CLng(Request("PageSize"))
    If intPageSize = 0 Then intPageSize = 30

    Set Recordset1 = Server.CreateObject("ADODB.Recordset")

    strStudentNum = ReplaceBadChar(Trim(Request("StudentNum")))
    strName = ReplaceBadChar(Trim(Request("Name")))
    strGrade = Trim(Request("Grade"))
    strClass = Trim(Request("ClassSelect"))
    If strGrade <> "" And strClass <> "" Then
        If strClass = "All" Then
            Recordset1Sql = "SELECT *  FROM StudentInfo WHERE GradeID=" & strGrade & " ORDER BY StudentNum"
        Else
            Recordset1Sql = "SELECT *  FROM StudentInfo WHERE GradeID=" & strGrade & " and ClassID=" & strClass & "  ORDER BY StudentNum"
        End If
    End If
    If strStudentNum <> "" Then
        Recordset1__MMColParam = strStudentNum
        Recordset1Sql = "SELECT *  FROM StudentInfo  WHERE StudentNum like '%" & Recordset1__MMColParam & "%'  ORDER BY StudentNum"
    End If
    If strName <> "" And strStudentNum = "" Then
        Recordset1__MMColParam = strName
        Recordset1Sql = "SELECT *  FROM StudentInfo  WHERE Name like '%" & Recordset1__MMColParam & "%'  ORDER BY StudentNum"
    End If
'response.write Recordset1Sql
'response.end
    Recordset1.Open Recordset1Sql, Conn_Sdms, 1, 3


    Response.Write "<table border='0' cellpadding='0' cellspacing='0'>" & vbCrLf
    Response.Write " <tr>" & vbCrLf
    Response.Write "  <td align='center'>" & vbCrLf
    Response.Write "" & vbCrLf

    If strStudentNum <> "" Then
        strTitle = "学号中含有“" & strStudentNum & "”"
    ElseIf strName <> "" Then
        strTitle = "姓名中含有“" & strName & "”"
    Else
        If strClass <> "" And strGrade <> "" Then
            Dim SearchResult, GradeName
            If Trim(strClass) = "All" Then
                strClass = " 全级"
                Set GradeName = Conn_Sdms.Execute("Select GradeName From Grade Where GradeID=" & strGrade & "")
                strTitle = GradeName(0) & " " & strClass
                Set GradeName = Nothing
            Else
                Set SearchResult = Conn_Sdms.Execute("Select G.GradeName,C.ClassName From Class C Left join Grade G On C.GradeID= G.GradeID Where C.ClassID=" & CLng(strClass) & "")
                strTitle = SearchResult(0) & " " & SearchResult(1)
                Set SearchResult = Nothing
            End If

        End If
        
    End If

    strTitle = strTitle & "的学生名单"
    If Recordset1.EOF And Recordset1.BOF Then
        Response.Write "<br><BR><BR><BR><font color='#FF3399'>抱歉！找不到您所寻找的学生记录！</font><BR><BR><BR>"
    Else
        Recordset1.movefirst
        While Not Recordset1.EOF
            Response.Write "<p align='center'><br><font size='6'><b>" & strTitle & "</b></font></p>"
            Repeat1__numRows = intPageSize
            Response.Write "        <table border=1 cellpadding='1' cellspacing=0 bordercolor='#999999'>" & vbCrLf
            Response.Write "          <tr valign='middle'> " & vbCrLf
            If Request("chkStudentNum") = "True" Then
                Response.Write "            <td width='60' height='30' align='center' nowrap>" & vbCrLf
                Response.Write "            <strong>" & vbCrLf
                Response.Write "            <font color='#000000'> " & vbCrLf
                Response.Write "              学 号</font>" & vbCrLf
                Response.Write "              </strong>" & vbCrLf
                Response.Write "              </td>" & vbCrLf
            End If
            If Request("chkName") = "True" Then
                Response.Write "          <td width='50' height='30' align='center' nowrap>" & vbCrLf
                Response.Write "          <strong>" & vbCrLf
                Response.Write "          <font color='#000000'> " & vbCrLf
                Response.Write "            姓 名</font>" & vbCrLf
                Response.Write "            </strong>" & vbCrLf
                Response.Write "            </td>" & vbCrLf
            End If
            If Request("chkSex") = "True" Then
                Response.Write "            <td width='30' height='30' align='center' nowrap>" & vbCrLf
                Response.Write "            <strong>" & vbCrLf
                Response.Write "            <font color='#000000'> " & vbCrLf
                Response.Write "              性别</font>" & vbCrLf
                Response.Write "              </strong>" & vbCrLf
                Response.Write "              </td>" & vbCrLf
            End If
            If Request("chkFolk") = "True" Then
                Response.Write "            <td width='50' height='30' align='center' nowrap>" & vbCrLf
                Response.Write "            <strong>" & vbCrLf
                Response.Write "            <font color='#000000'> " & vbCrLf
                Response.Write "              民族</font>" & vbCrLf
                Response.Write "              </strong>" & vbCrLf
                Response.Write "              </td>" & vbCrLf
            End If
            If Request("chkPlace") = "True" Then
                Response.Write "            <td width='50' height='30' align='center' nowrap>" & vbCrLf
                Response.Write "            <strong>" & vbCrLf
                Response.Write "            <font color='#000000'> " & vbCrLf
                Response.Write "              籍贯</font>" & vbCrLf
                Response.Write "              </strong>" & vbCrLf
                Response.Write "              </td>" & vbCrLf
            End If
            If Request("chkPolitics") = "True" Then
                Response.Write "            <td width='60' height='30' align='center' nowrap>" & vbCrLf
                Response.Write "            <strong>" & vbCrLf
                Response.Write "            <font color='#000000'> " & vbCrLf
                Response.Write "              政治面貌</font>" & vbCrLf
                Response.Write "              </strong>" & vbCrLf
                Response.Write "              </td>" & vbCrLf
            End If
            If Request("chkBirth") = "True" Then
                Response.Write "            <td width='60' height='30' align='center' nowrap>" & vbCrLf
                Response.Write "            <strong>" & vbCrLf
                Response.Write "            <font color='#000000'> " & vbCrLf
                Response.Write "              出生日期</font>" & vbCrLf
                Response.Write "              </strong>" & vbCrLf
                Response.Write "              </td>" & vbCrLf
            End If
            If Request("chkEnrollment") = "True" Then
                Response.Write "            <td width='60' height='30' align='center' nowrap>" & vbCrLf
                Response.Write "            <strong><font color='#000000'> " & vbCrLf
                Response.Write "              入学时间</font>" & vbCrLf
                Response.Write "              </strong>" & vbCrLf
                Response.Write "              </td>" & vbCrLf
            End If
            If Request("chkHousemaster") = "True" Then
                Response.Write "            <td width='60' height='30' align='center' nowrap>" & vbCrLf
                Response.Write "            <strong>" & vbCrLf
                Response.Write "            <font color='#000000'> " & vbCrLf
                Response.Write "              家长姓名</font>" & vbCrLf
                Response.Write "              </strong>" & vbCrLf
                Response.Write "              </td>" & vbCrLf
            End If
            If Request("chkTelnum") = "True" Then
                Response.Write "            <td width='80' height='30' align='center' nowrap>" & vbCrLf
                Response.Write "            <strong>" & vbCrLf
                Response.Write "            <font color='#000000'> " & vbCrLf
                Response.Write "              联系电话</font>" & vbCrLf
                Response.Write "              </strong>" & vbCrLf
                Response.Write "              </td>" & vbCrLf
            End If
            If Request("chkHouseAddress") = "True" Then
                Response.Write "            <td width='150' height='30' align='center' nowrap>" & vbCrLf
                Response.Write "            <strong>" & vbCrLf
                Response.Write "            <font color='#000000'> " & vbCrLf
                Response.Write "              家庭住址</font>" & vbCrLf
                Response.Write "              </strong>" & vbCrLf
                Response.Write "              </td>" & vbCrLf
            End If
            If Request("chkRemark") = "True" Then
                Response.Write "            <td width='40' height='30' align='center' nowrap>" & vbCrLf
                Response.Write "            <strong>" & vbCrLf
                Response.Write "            <font color='#000000'> " & vbCrLf
                Response.Write "              备注</font>" & vbCrLf
                Response.Write "              </strong>" & vbCrLf
                Response.Write "              </td>" & vbCrLf
            End If
            Response.Write "          </tr>" & vbCrLf
            Response.Write "" & vbCrLf
            Dim txtStudentNum, txtName, txtSex, txtFolk, txtplace, txtPolitics, txtBirth, txtEnrollment, txtHousemaster, txtTelnum, txtHouseAddress, txtRemark
            While ((Repeat1__numRows <> 0) And (Not Recordset1.EOF))

                txtStudentNum = Recordset1.Fields.Item("StudentNum").value & ""
                txtName = Replace(Recordset1.Fields.Item("Name").value & "", " ", "&nbsp;")
                If txtName = "" Then txtName = "&nbsp;"
                txtSex = Replace(Recordset1.Fields.Item("Sex").value & "", " ", "&nbsp;")
                If txtSex = "" Then txtSex = "&nbsp;"
                txtFolk = Replace(Recordset1.Fields.Item("Folk").value & "", " ", "&nbsp;")
                If txtFolk = "" Then txtFolk = "&nbsp;"
                txtplace = Replace(Recordset1.Fields.Item("place").value & "", " ", "&nbsp;")
                If txtplace = "" Then txtplace = "&nbsp;"
                txtPolitics = Replace(Recordset1.Fields.Item("politics").value & "", " ", "&nbsp;")
                If txtPolitics = "" Then txtPolitics = "&nbsp;"
                txtBirth = Replace(Recordset1.Fields.Item("Birthday").value & "", " ", "&nbsp;")
                If txtBirth = "" Then txtBirth = "&nbsp;"
                txtEnrollment = Replace(Recordset1.Fields.Item("enrollment").value & "", " ", "&nbsp;")
                If txtEnrollment = "" Then txtEnrollment = "&nbsp;"
                txtHousemaster = Replace(Recordset1.Fields.Item("housemaster").value & "", " ", "&nbsp;")
                If txtHousemaster = "" Then txtHousemaster = "&nbsp;"
                txtTelnum = Replace(Recordset1.Fields.Item("TelNum").value & "", " ", "&nbsp;")
                If txtTelnum = "" Then txtTelnum = "&nbsp;"
                txtHouseAddress = Replace(Recordset1.Fields.Item("HouseAddress").value & "", " ", "&nbsp;")
                If txtHouseAddress = "" Then txtHouseAddress = "&nbsp;"
                txtRemark = Replace(Recordset1.Fields.Item("Remark").value & "", " ", "&nbsp;")
                If txtRemark = "" Then txtRemark = "&nbsp;"

                Response.Write "          <tr valign='middle'> " & vbCrLf
                If Request("chkStudentNum") = "True" Then
                    Response.Write "            <td width='60' height='28' align='center' nowrap>" & vbCrLf
                    Response.Write txtStudentNum
                    Response.Write "            </td>" & vbCrLf
                End If
                If Request("chkName") = "True" Then
                    Response.Write "            <td width='50' height='28' align='center' nowrap>" & vbCrLf
                    Response.Write txtName
                    Response.Write "            </td>" & vbCrLf
                End If
                If Request("chkSex") = "True" Then
                    Response.Write "            <td width='30' height='28' align='center' nowrap>" & vbCrLf
                    Response.Write txtSex
                    Response.Write "            </td>" & vbCrLf
                End If
                If Request("chkFolk") = "True" Then
                    Response.Write "            <td width='50' height='28' align='center' nowrap>" & vbCrLf
                    Response.Write txtFolk
                    Response.Write "            </td>" & vbCrLf
                End If
                If Request("chkPlace") = "True" Then
                    Response.Write "            <td width='50' height='28' align='center'>" & vbCrLf
                    Response.Write txtplace
                    Response.Write "            </td>" & vbCrLf
                End If
                If Request("chkPolitics") = "True" Then
                    Response.Write "            <td width='60' height='28' align='center' nowrap>" & vbCrLf
                    Response.Write txtPolitics
                    Response.Write "            </td>" & vbCrLf
                End If
                If Request("chkBirth") = "True" Then
                    Response.Write "            <td width='60' height='28' align='left' nowrap>" & vbCrLf
                    Response.Write txtBirth
                    Response.Write "            </td>" & vbCrLf
                End If
                If Request("chkEnrollment") = "True" Then
                    Response.Write "            <td width='60' height='28' align='center' nowrap>" & vbCrLf
                    Response.Write txtEnrollment
                    Response.Write "            </td>" & vbCrLf
                End If
                If Request("chkHousemaster") = "True" Then
                    Response.Write "            <td width='60' height='28' align='center' nowrap>" & vbCrLf
                    Response.Write txtHousemaster
                    Response.Write "            </td>" & vbCrLf
                End If
                If Request("chkTelnum") = "True" Then
                    Response.Write "            <td width='80' height='28' align='center' nowrap>" & vbCrLf
                    Response.Write txtTelnum
                    Response.Write "            </td>" & vbCrLf
                End If
                If Request("chkHouseAddress") = "True" Then
                    Response.Write "            <td width='150' height='28' align='left'>" & vbCrLf
                    Response.Write txtHouseAddress
                    Response.Write "            </td>" & vbCrLf
                End If
                If Request("chkRemark") = "True" Then
                    Response.Write "            <td width='40' height='28' align='left'>" & vbCrLf
                    Response.Write txtRemark
                    Response.Write "            </td>" & vbCrLf
                End If
                Response.Write "          </tr>" & vbCrLf
                Response.Write "" & vbCrLf

                Repeat1__numRows = Repeat1__numRows - 1
                Recordset1.MoveNext
            Wend
            Response.Write " </table>" & vbCrLf

        Wend
    End If

    Response.Write "      </td>" & vbCrLf
    Response.Write "     </tr>" & vbCrLf
    Response.Write "    </table>" & vbCrLf
    Response.Write "" & vbCrLf

    Recordset1.Close

End Sub
%>
