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

📄 infoquery2.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 Request.QueryString<>"" then Session("strQureyString")=Request.QueryString
if Request.Form<>"" then Session("strQureyString")=Request.Form

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
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters

' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "") Then MM_removeList = MM_removeList & "&" & MM_paramName & "="
MM_keepURL="":MM_keepForm="":MM_keepBoth="":MM_keepNone=""

' add the URL parameters to the MM_keepURL string
For Each Item In Request.QueryString
  NextItem = "&" & Item & "="
  If (InStr(1,MM_removeList,NextItem,1) = 0) Then
    MM_keepURL = MM_keepURL & NextItem & Server.URLencode(Request.QueryString(Item))
  End If
Next

' add the Form variables to the MM_keepForm string
For Each Item In Request.Form
  NextItem = "&" & Item & "="
  If (InStr(1,MM_removeList,NextItem,1) = 0) Then
    MM_keepForm = MM_keepForm & NextItem & Server.URLencode(Request.Form(Item))
  End If
Next

' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
if (MM_keepBoth <> "") Then MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
if (MM_keepURL <> "")  Then MM_keepURL  = Right(MM_keepURL, Len(MM_keepURL) - 1)
if (MM_keepForm <> "") Then MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)

' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
  If (firstItem <> "") Then
    MM_joinChar = "&"
  Else
    MM_joinChar = ""
  End If
End Function
%>
<%
'  *** 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>
function unselectall()
{
    if(document.del.chkAll.checked){
	document.del.chkAll.checked = document.del.chkAll.checked&0;
    } 	
}

function CheckAll(form)
  {
  for (var i=0;i<form.elements.length;i++)
    {
    var e = form.elements[i];
    if (e.Name != 'chkAll')
       e.checked = form.chkAll.checked;
    }
  }
function ConfirmDel()
{
   if(confirm("确定要删除选中的记录吗?一旦删除将不能恢复!"))
     return true;
   else
     return false;
	 
}

</SCRIPT>
</HEAD>
<BODY text=#000000 bgColor=#ffffff leftMargin=0 topMargin=0>
<!--#include file="InfoManage_Top.asp"-->
<TABLE cellSpacing=0 cellPadding=0 width=760 align=center border=0>
  <TBODY>
    <TR> 
      <TD valign="top" bgcolor="#F2FBF2"><img src="images/InfoModifyDel_Title.gif">
<% 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"> 
          <% flgDel=Session("txtDel")
			  if flgDel<>"" then %>
          记录已成功删除! 
          <% else %>
          抱歉!找不到您所寻找的学生记录! 
          <% end if %>
          </font><BR>
          <BR>
          <BR>
          <BR>
        </div>
        <% End If ' end Recordset1.EOF And Recordset1.BOF %>
		<% If Not Recordset1.EOF Or Not Recordset1.BOF Then %>
        <form Name="del" onsubmit="return ConfirmDel()" method="post" action="InfoDel2.asp">
<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
			%>
          &nbsp;&nbsp;&nbsp;&nbsp;共找到&nbsp;<font color="#FF0000"><%=(Recordset1_total)%></font>&nbsp;条记录!          <table cellspacing=0 width="100%" border=1 cellpadding="1" bordercolor="#FFCC00" align="center">
            <tr align="center" valign="middle" bordercolor="#FFCC00"> 
              <td nowrap><font color="#000000">是否<br>
                删除</font></td>
              <td nowrap><font color="#000000">学 号</font></td>
              <td nowrap><font color="#000000">姓名</font></td>
              <td nowrap><font color="#000000">性别</font></td>
              <td nowrap><font color="#000000">民族</font></td>
              <td nowrap><font color="#000000">籍 贯</font></td>
              <td nowrap><font color="#000000">政治面貌</font></td>
              <td nowrap><font color="#000000">出生日期</font></td>
              <td nowrap><font color="#000000">入学时间</font></td>
              <td nowrap><font color="#000000">家长姓名</font></td>
              <td nowrap><font color="#000000">联系电话</font></td>
              <td nowrap><font color="#000000">家庭住址</font></td>
              <td width="60" nowrap><font color="#000000">操作</font></td>
            </tr>
            <% 
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;"
%>
            <tr> 
              <td height="20" align="center"> 
                <input type="checkbox" value="<%= (Recordset1.Fields.Item("StudentNum").Value) %>" onclick=unselectall() Name="chkNum"> 
              </td>
              <td height="20" align="center" nowrap> 
                <%=txtStudentNum%></td>
              <td height="20" align="center" nowrap> 
                <%=txtName%></td>
              <td height="20" align="center"> 
                <%=txtSex%></td>
              <td height="20" align="center" nowrap> 
                <%=txtFolk%></td>
              <td height="20" align="center" nowrap> 
                <%=txtplace%></td>
              <td height="20" align="center" nowrap> 
                <%=txtPolitics%></td>
              <td height="20" align="center" 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"> 
                <%=txtHouseAddress%></td>
              <td align="center" height="20"> 
                <a href="InfoModify.asp?<%= MM_keepNone & MM_joinChar(MM_keepNone) & "StudentNum=" & Recordset1.Fields.Item("StudentNum").Value %>">修改</a>&nbsp;<a href="InfoDel.asp?<%= MM_keepNone & MM_joinChar(MM_keepNone) & "StudentNum=" & Recordset1.Fields.Item("StudentNum").Value %>">删除</a></td>
            </tr>
            <% 
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  Recordset1.MoveNext()
Wend
%>
          </table>
          <br>
          <table border="0" cellspacing="0" cellpadding="0" align="left">
            <tr> 
              <td width="104"> <input type="checkbox" Name="chkAll" value="1" onclick=CheckAll(this.form)>
                全部选定</td>
              <td width="104">&nbsp; </td>
              <td width="46"> <input type="submit" Name="Submit" value="删除选定的记录"> 
              </td>
            </tr>
          </table>
        </form>
        <% End If ' end Not Recordset1.EOF Or NOT Recordset1.BOF %> </TD>
    </TR>
  </TBODY>
</TABLE>
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>
		<Iframe src="http://cqzx.sdedu.net/sdms/CopyRight.asp" width="760" height="200" marginheight="0" marginwidth="0" scrolling="NO" frameborder="0" name="CopyRight"></iframe>
	</td>
  </tr>
</table></BODY>
</HTML>
<%
Recordset1.Close()
%>

⌨️ 快捷键说明

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