www.gusucode.com > ASP+ACCESS学生管理系统通过答辩的毕业设计(源代码+论文) > ASP+ACCESS学生管理系统通过答辩的毕业设计(源代码+论文)\web\browseInfo.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <% If Session("UserName") = "" Then Response.Redirect "login.htm" End If %> <HTML> <HEAD> <TITLE>查询学生资料</TITLE> <STYLE> P, TABLE, SELECT, INPUT{FONT-SIZE: 9pt} .style2 {color: #003366} .style3 {color: #FFFFFF} </STYLE> </HEAD> <BODY> <div align="center"> <% Response.Buffer = True Response.ExpiresAbsolute = Now() - 1 Response.Expires = 0 Response.CacheControl = "no-cache" Response.AddHeader "Pragma", "No-Cache" %> <img src="image/logo.gif" width="500" height="200"> </div> <P align="center"><A HREF = "index.asp" >返回首页</A>| <% If Session("Level") > 1 Then %> <A HREF = "addInfo.asp" >添加资料</A>| <A HREF = "editInfo.asp" >修改资料</A>| <A HREF = "deleteInfo.asp" >删除资料</A> <% End If %></P> <!-- #include file="inc\adovbs.inc" --> <DIV ALIGN = "center"> <FORM NAME = "Form1" METHOD = "post" ACTION = "browseInfo.asp"> <table width="100%" border="0"> <tr> <td width="538" bgcolor="#003399"><div align="center" class="style3"> <div align="right">学生查询: <select size = "1" name = "lstFld"> <option selected value = "all">全部显示</option> <option value = "department">所在院系</option> <option value = "speciality">所在专业</option> <option value = "grade">年级</option> <option value = "class">班级</option> <option value = "student_num">学号</option> <option value = "student_sex">性别</option> <option value = "student_name">姓名</option> </select> 值: <input name = "txtValue" type = "text" size = "10"> <input name = "btnSubmit" type = "submit" value = "查询"> </div> </div></td> </tr> </table> </FORM> <% Dim cnn, rst, sSQL, currentPage, rowCount, i If Request.Form("btnSubmit") = "" Then Response.End End If currentPage = Request.QueryString("currentPage") If currentPage = "" Then currentPage = 1 End If Set cnn = Server.CreateObject("ADODB.Connection") Set rst = Server.CreateObject("ADODB.Recordset") cnn.ConnectionString = "PROVIDER=microsoft.jet.oledb.4.0;DATA SOURCE=" & server.mappath("Date\date.mdb") cnn.Open rst.CursorType = adOpenStatic rst.PageSize = 15 Field = Request.Form("lstFld") Value = Trim(Request.Form("txtValue")) If Field = "all" Then sSQL = "SELECT * FROM students ORDER BY student_num" End If If Field <> "all" And Value <> "" Then sSQL = "SELECT * FROM students WHERE " & Field & "='" & Value & "' ORDER BY student_num" End If rst.Open sSQL, cnn If rst.EOF Then Response.Write "<P><FONT COLOR = red>没有找到符合条件的记录!</FONT></P>" Else rowCount = 0 %> <TABLE WIDTH = "56%" BORDER = "0" cellpadding="2" cellspacing="1" bordercolor="#003399"> <tr bgcolor="#003399"><th colspan="4" class="style3"><B>查询结果:</B>共<% = rst.RecordCount %>个学生</th></tr> <TR bgcolor="#CCCCCC"> <TH width="32%"><span class="style2">学号</span></TH> <TH width="28%"><span class="style2">姓名</span></TH> <TH width="18%"><span class="style2">性别</span></TH> <TH width="22%"><span class="style2">出生日期</span></TH> </TR> <% While Not rst.EOF And rowCount < rst.PageSize %> <TR bgcolor="#CCCCCC"> <TD><A HREF=detailInfo.asp?StuNum=<% = rst("student_num") %> class="style2"> <% = rst("student_num") %></A></TD> <TD><span class="style2"> <% = rst("student_name") %> </span></TD> <TD><span class="style2"> <% = rst("student_sex") %> </span></TD> <TD><span class="style2"> <% = rst("birthdate") %> </span></TD> </TR> <% rowCount = rowCount + 1 rst.MoveNext Wend %> </TABLE> <P> 每页<% = rst.PageSize %>个学生 当前页次:<% = currentPage %>/<% = rst.PageCount %>页 <% For i = 1 To rst.PageCount If i = CInt(currentPage) Then %>[<FONT COLOR = "red"><%= i %></FONT>] <% Else %> [<A HREF = "browseInfo.asp?currentPage=<%= i %>"><%= i %></A>] <% End If Next End If %> </P></DIV> </BODY> </HTML>