⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 infoquery1.asp

📁 一篇不错的好论文
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/StudentConn.asp" -->
<%
Dim Recordset1__MMColParam, strStudentNum, strName, strGrade, strClass

set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_StudentConn_STRING

strStudentNum= Request("StudentNum")
strName=Request("Name")
strGrade=Request("Grade")
strClass=Request("ClassSelect")
if strStudentNum <> "" then
  Recordset1__MMColParam =strStudentNum
  Recordset1.Source = "SELECT *  FROM StudentInfo  WHERE StudentNum like '%" & Recordset1__MMColParam & "%'  ORDER BY StudentNum"
end if
if strName<>"" then
  Recordset1__MMColParam =strName
  Recordset1.Source = "SELECT *  FROM StudentInfo  WHERE Name like '%" & Recordset1__MMColParam & "%'  ORDER BY StudentNum"
end if
if strGrade<>"" and strClass<>"" then
  If len(Year(Now()))<=2 Then
    NewYear="20" & Year(Now())
  Else
    NewYear=Year(Now())
  End If
  If len(Month(Now()))<=1 Then
    NewMonth="0" & Month(Now())
  Else
    NewMonth=Month(Now())
  End If
  if NewMonth<9 then
    strStudentNum=NewYear-strGrade-1
  else
    strStudentNum=NewYear-strGrade
  end if
  if strClass="All" then strClass=""
  if Len(strClass)=1 then
    strClass="0" & strClass
  end if
  Recordset1__MMColParam =strStudentNum & strClass
  Recordset1.Source = "SELECT *  FROM StudentInfo  WHERE StudentNum like '" & Recordset1__MMColParam & "%'  ORDER BY StudentNum"
end if

Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 3
Recordset1.Open()
Recordset1_numRows = 0
%>
<%
Dim Repeat1__numRows
Repeat1__numRows = -1
Dim Repeat1__index
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<%
'  *** Recordset Stats, Move To Record, and Go To Record: declare stats variables

Dim Recordset1_total
Dim Recordset1_first
Dim Recordset1_last

' set the record count
Recordset1_total = Recordset1.RecordCount

' set the number of rows displayed on this page
If (Recordset1_numRows < 0) Then
  Recordset1_numRows = Recordset1_total
Elseif (Recordset1_numRows = 0) Then
  Recordset1_numRows = 1
End If

' set the first and last displayed record
Recordset1_first = 1
Recordset1_last  = Recordset1_first + Recordset1_numRows - 1

' if we have the correct record count, check the other stats
If (Recordset1_total <> -1) Then
  If (Recordset1_first > Recordset1_total) Then
    Recordset1_first = Recordset1_total
  End If
  If (Recordset1_last > Recordset1_total) Then
    Recordset1_last = Recordset1_total
  End If
  If (Recordset1_numRows > Recordset1_total) Then
    Recordset1_numRows = Recordset1_total
  End If
End If
%>

<%
' *** Recordset Stats: if we don't know the record count, manually count them

If (Recordset1_total = -1) Then

  ' count the total records by iterating through the recordset
  Recordset1_total=0
  While (Not Recordset1.EOF)
    Recordset1_total = Recordset1_total + 1
    Recordset1.MoveNext
  Wend

  ' reset the cursor to the beginning
  If (Recordset1.CursorType > 0) Then
    Recordset1.MoveFirst
  Else
    Recordset1.Requery
  End If

  ' set the number of rows displayed on this page
  If (Recordset1_numRows < 0 Or Recordset1_numRows > Recordset1_total) Then
    Recordset1_numRows = Recordset1_total
  End If

  ' set the first and last displayed record
  Recordset1_first = 1
  Recordset1_last = Recordset1_first + Recordset1_numRows - 1
  
  If (Recordset1_first > Recordset1_total) Then
    Recordset1_first = Recordset1_total
  End If
  If (Recordset1_last > Recordset1_total) Then
    Recordset1_last = Recordset1_total
  End If

End If
%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>学生信息查询</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2600.0" Name=GENERATOR>
<link rel="stylesheet" href="home.css" type="text/css">
<script language="JavaScript" type="text/JavaScript">
function check1()
{
  if(document.form1.StudentNum.value=="")
  {
    alert("你还没有填学号");
    document.form1.StudentNum.focus();
    return false;
  }
}
function check2()
{
  if(document.form2.Name.value=="")
  {
    alert("你还没有填姓名");
    document.form2.Name.focus();
    return false;
  }
}
</script>
</HEAD>
<BODY text=#000000 bgColor=#ffffff leftMargin=0 topMargin=0>
<!--#include file="Top.asp"-->
<TABLE cellSpacing=0 cellPadding=0 width=750 align=center border=0>
  <TBODY>
    <TR> 
      <TD vAlign=top width=46 background=images/p_left_2.gif></TD>
      <TD width=20>&nbsp;</TD>
      <TD> 
	  		<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<tr> 
              
            <td width="25%" height=30><img src="images/info.gif" width="16" height="16"><a href="InfoInput.asp">录入学生信息</a></td>
              
            <td width="25%" height=30 ><img src="images/info.gif" width="16" height="16"><a href="InfoQuery.asp">查询学生信息</a></td>
              
            <td width="25%" height=30><img src="images/info.gif" width="16" height="16"><a href="InfoModifyDel.asp">修改/删除学生信息</a></td>
              
            <td height=30 width="25%">&nbsp;</td>
            </tr>
            </table>
			<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
			<TR> 
              <TD colspan="4"> <p align="center"><br>
                  <b><font size="5">查询学生信息</font></b></p>
                <br> <font color="#FF0000"><b>查询条件:</b></font> <%
			 if Request("StudentNum")<>"" then
			     response.write "学号中含有“" & strStudentNum & "”"
			 elseif strName<>"" then
			     response.write "姓名中含有“" & strName & "”"
			 else
				 if strClass<>"" then strClass=strClass & "班" 
				 response.write "高" & strGrade+1 & "级" & strClass
			 end if
			 response.Write("&nbsp;&nbsp;")
			%>
			<% If Recordset1.EOF And Recordset1.BOF Then %>
                <div align="center"> <br>
                  <BR>
                  <BR>
                  <BR>
                  <img src="images/cat008.gif" width="90" height="80" align="absmiddle"><font color="#FF3399">抱歉!找不到您所寻找的学生记录!</font><BR>
                  <BR>
                  <BR>
                  <BR>
                </div>
                <% End If ' end Recordset1.EOF And Recordset1.BOF %> <% If Not Recordset1.EOF Or Not Recordset1.BOF Then %>
              共找到&nbsp;<font color="#FF0000"><%=(Recordset1_total)%></font>&nbsp;条记录! 
                
              <table cellspacing=0 width="100%" border=1 cellpadding="1" bordercolor="#FFCC00" align="center">
                <tr bordercolor="#FFCC00"> 
                  <td height="25" align="center" nowrap><font color="#000000"> 
                    学 号</font></td>
                  <td height="25" align="center" nowrap><font color="#000000"> 
                    姓名</font></td>
                  <td height="25" align="center" nowrap><font color="#000000"> 
                    性别</font></td>
                  <td height="25" align="center" nowrap><font color="#000000"> 
                    民族</font></td>
                  <td height="25" align="center" nowrap><font color="#000000"> 
                    籍贯</font></td>
                  <td height="25" align="center" nowrap><font color="#000000"> 
                    政治面貌</font></td>
                  <td height="25" align="center" nowrap><font color="#000000"> 
                    出生年月</font></td>
                  <td height="25" align="center" nowrap><font color="#000000"> 
                    入学时间</font></td>
                  <td height="25" align="center" nowrap><font color="#000000"> 
                    家长姓名</font></td>
                  <td height="25" align="center" nowrap><font color="#000000"> 
                    联系电话</font></td>
                  <td height="25" align="center" nowrap><font color="#000000"> 
                    家庭住址</font></td>
                </tr>
                <% 
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF)) 
%>
                <%
  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;"
%>
                <tr> 
                  <td height="20" align="center" nowrap><%=(Recordset1.Fields.Item("StudentNum").Value)%></td>
                  <td height="20" align="center" nowrap><%=txtName%></td>
                  <td height="20" align="center" nowrap><%=txtSex%></td>
                  <td height="20" align="center" nowrap><%=txtFolk%></td>
                  <td height="20" align="center"><%=txtplace%></td>
                  <td height="20" align="center" nowrap><%=txtPolitics%></td>
                  <td height="20" align="left" nowrap><%=txtBirth%></td>
                  <td height="20" align="center" nowrap><%=txtEnrollment%></td>
                  <td height="20" align="center" nowrap><%=txtHousemaster%></td>
                  <td height="20" align="center" nowrap><%=txtTelnum%></td>
                  <td height="20" align="left"><%=txtHouseAddress%></td>
                </tr>
                <% 
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  Recordset1.MoveNext()
Wend
%>
              </table>
                <% End If ' end Not Recordset1.EOF Or NOT Recordset1.BOF %> <br> <br> <TABLE width="100%" border=1 cellPadding=5 cellSpacing=0 bordercolor="#FFCCFF">
                  <TBODY>
                    <TR> 
                      
                    <TD width="316" vAlign=top> <b>继续查询其他学生信息</b>
<table width="300" border="0" cellspacing="0" cellpadding="5">
                        <form Name="form1" onSubmit="return check1()" action="InfoQuery1.asp" method="post">
                          <tr> 
                            <td>按学号查询:</td>
                            <td> <input name="StudentNum" type="text" id="StudentNum" size="18" maxlength="8"></td>
                            <td> <input type="submit" name="Submit1" value="查询"></td>
                          </tr>
                        </form>
                        <form Name="form2" onSubmit="return check2()"  action="InfoQuery1.asp" method="post">
                          <tr> 
                            <td>按姓名查询:</td>
                            <td> <input type="text" name="Name" maxlength="8" size="18"></td>
                            <td> <input type="submit" name="Submit2" value="查询"></td>
                          </tr>
                        </form>
                        <form Name="form3" action="InfoQuery1.asp" method="post">
                          <tr> 
                            <td>按班级查询:</td>
                            <td> <select name="Grade">
                              <option value="0" selected>高一级</option>
                              <option value="1">高二级</option>
                              <option value="2">高三级</option>
                            </select> &nbsp; <select name="ClassSelect">
                                <option value="01">1班</option>
                                <option value="02">2班</option>
                                <option value="03">3班</option>
                                <option value="04">4班</option>
                                <option value="05">5班</option>
                                <option value="06">6班</option>
                                <option value="07">7班</option>
                                <option value="08">8班</option>
                                <option value="09">9班</option>
                                <option value="10">10班</option>
                                <option value="11">11班</option>
                                <option value="12">12班</option>
                                <option value="All" selected>全级</option>
                              </select></td>
                            <td> <input type="submit" name="Submit3" value="查询"></td>
                          </tr>
                        </form>
                      </table></TD>
                      <TD width="328"><b>注:</b> <br>
                        1、可从学号、姓名或班级三种查询方法任选其一进行查询。<br> <font color="#FF0000">2、支持模糊查询!</font><br>
                        例如:<br> &nbsp;&nbsp;&nbsp;&nbsp;在学号查询框中输入2001,则查询结果为学号中包含“2001”的学生<br> 
                        &nbsp;&nbsp;&nbsp;&nbsp;在姓名中输入“小”,则查询结果为姓名中包含有“小”的学生 </TD>
                    </TR>
                </TABLE></TD>
            </TR>
        </TABLE></TD>
    </TR>
  </TBODY> 
</TABLE>
<!--#include file="CopyRight.asp"-->
</BODY>
</HTML>
<%
Recordset1.Close()
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -