标题:是高手都来帮忙!!!
取消只看楼主
peiyanjian
Rank: 1
等 级:新手上路
帖 子:96
专家分:0
注 册:2008-2-29
 问题点数:0 回复次数:7 
是高手都来帮忙!!!
搜索要求姓名或是班级符合条件的都显示在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
%>
搜索更多相关主题的帖子: Microsoft DSNtemp student 
2008-03-22 12:04
peiyanjian
Rank: 1
等 级:新手上路
帖 子:96
专家分:0
注 册:2008-2-29
得分:0 
0000
基本就是这样的

help.GIF (24.91 KB)
2008-03-22 15:32
peiyanjian
Rank: 1
等 级:新手上路
帖 子:96
专家分:0
注 册:2008-2-29
得分:0 
是的,只是输入一项就能显示学生,就这个意思
2008-03-22 15:59
peiyanjian
Rank: 1
等 级:新手上路
帖 子:96
专家分:0
注 册:2008-2-29
得分:0 
一定帮我哦.我自己刚入门实在搞不出来了
2008-03-22 16:01
peiyanjian
Rank: 1
等 级:新手上路
帖 子:96
专家分:0
注 册:2008-2-29
得分:0 
我也想过,可是那个代码比这个复杂,我不会呀
2008-03-22 17:43
peiyanjian
Rank: 1
等 级:新手上路
帖 子:96
专家分:0
注 册:2008-2-29
得分:0 
这个是要上交的任务呀!!我得完成,学习我一直在学,一边学一边做的.
2008-03-23 08:30
peiyanjian
Rank: 1
等 级:新手上路
帖 子:96
专家分:0
注 册:2008-2-29
得分:0 
还是不行呀.代码要加到哪里呀?我怎么总是出错呢??
提示说
rs.open sql,conn,1,1
冲突....
2008-03-24 20:54
peiyanjian
Rank: 1
等 级:新手上路
帖 子:96
专家分:0
注 册:2008-2-29
得分:0 
你在呀??我不在这台机子上做东西.所以要上传上来很麻烦的.我得刻盘上传呀,

你能不能在你机子上试一下,传上来呀.
2008-03-24 21:02



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-204671-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.318458 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved