是高手都来帮忙!!!
搜索要求姓名或是班级符合条件的都显示在student表中,要如何写一下代码呢???高手来帮一下.急用!!
代码如下:
student.asp表
<!--#include virtual="/admin_qx.asp" -->
<!--#include file=ss.asp-->
<%
set conn=server.createobject("adodb.connection")
DSNtemp = "Driver={Microsoft Access Driver (*.mdb)};"
DSNtemp = DSNtemp & "DBQ=" & server.mappath("date/student.mdb")
conn.open DSNtemp
stext = "select id,xuehao,xingming,zhiwu, banji,chushengnianyue,minzu,zhengzhimianmao,dangtuanshijian,jiguan,ruwushijian,wenhuachengdu,lianxidianhua,ruwudiqu,jiatingzhuzhi,youzhengbianma from stu"
set rs = conn.execute(stext)
if rs.eof then
response.write "database error"
response.end
end if
%>
<html>
<head>
<title>adsda</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
a:link { color: #000000; text-decoration: none}
a:visited { color: #000000; text-decoration: none}
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<h2 align="center">欢迎来到dfs管理系统</h2>
<h4 align="center">可以点击某一行姓名来察看详细信息</h4>
<p><font color="#0066CC">相关操作: <a href="/xy_add.asp">添加学员</a> | <a href="/students.asp">显示信息</a>
| <a href="/index.ASP">退出登陆</a></font></p>
<p>
<form name="form1" method="post" action="/ss.asp">
<td> 姓名
<input name="xingming" type="text" maxlength="10" size="15">
班级
<input name="banji" type="text" maxlength="10" size="15">
<input name="submit" type="submit" value="显示学生">
</td>
</form>
</p>
<div align="center">
<table width="1600" border="1" cellpadding="0" cellspacing="0" bgcolor="#C7E8F8">
<tr>
<td>
<div align="center">姓名</div>
</td>
<td>
<div align="center">学号</div>
</td>
<td>
<div align="center">职务</div>
</td>
<td>
<div align="center">班级</div>
</td>
<td>
<div align="center">出生年月</div>
</td>
<td>
<div align="center">民族</div>
</td>
<td>
<div align="center">政治面貌</div>
</td>
<td>
<div align="center">党团时间</div>
</td>
<td>
<div align="center">籍贯</div>
</td>
<td>
<div align="center">入学时间</div>
</td>
<td>
<div align="center">文化程度</div>
</td>
<td>
<div align="center">联系电话</div>
</td>
<td>
<div align="center">入学地区</div>
</td>
<td>
<div align="center">家庭地址</div>
</td>
<td>
<div align="center">邮政编码</div>
</td>
</tr>
<%
Do while not rs.eof
%>
<TR>
<TD><div align="center"><a href='/stu_xx.asp?id=<%=rs("id") %>'><%=rs("xingming") %></a></div></TD>
<%
%>
<td><div align="center">0<%=rs("xuehao") %></div></td><td><div align="center"><%=rs("zhiwu") %></div></td><td><div align="center"><%=rs("banji") %></div></td><td><div align="center"><%=rs("chushengnianyue") %></div></td><td><div align="center"><%=rs("minzu") %></div></td><td><div align="center"><%=rs("zhengzhimianmao") %></div></td><td><div align="center"><%=rs("dangtuanshijian") %></div></td><td><div align="center"><%=rs("jiguan") %></div></td><td><div align="center"><%=rs("ruwushijian") %></div></td><td><div align="center"><%=rs("wenhuachengdu") %></div></td><td><div align="center"><%=rs("lianxidianhua") %></div></td><td><div align="center"><%=rs("ruwudiqu") %></div></td><td><div align="center"><%=rs("jiatingzhuzhi") %></div></td><td><div align="center"><%=rs("youzhengbianma") %></div></td></tr>
<%
rs.movenext
Loop
%>
</table>
</div>
<%
rs.close
conn.close
%>
<hr>
</body>
</html>
aa.asp表
<%Dim rs,conn
xingming=request.form("xingming")
banji = request.form("banji")
'cmonth = request.form("month")
if xingming="" and banji="" then
response.write "data cannot empty"
response.end
'else
'response.write xingming
'response.write banji
'response.end
end if
conn = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("/date/student.mdb")
Set rs = Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = conn
sql = "SELECT * FROM stu WHERE xingming like'" + xingming + "' or banji like '" + banji + "'"
rs.open sql,conn,3,3
rscount=rs.RecordCount
for i=0 to rscount
if i<rscount then
i=+i
response.write rs.Fields("title") & "<br>"
rs.MoveNext()
end if
next
rs.Close()
Set rs = Nothing
%>