asp关于复选框传值调出数据的问题

zcc405331 2015-07-24 09:51:13
我的想法是选中几个学号 从另一张表里调出这几个学号的姓名 现在的结果是显示空白,各位大侠帮忙看看,分数不是很多了,请大侠帮帮忙

第一个页面11.asp 第二个页面22.asp


第一个页面11.asp

<form name="del" method="Post" action="22.asp" >	
<table width="266" border="1">
<tr>
<td width="132">学号</td>
<td width="118">全选</td>
</tr>
<tr>
<td>201501</td>
<td><input name="member" type="checkbox" value="201501"></td>
</tr>
<tr>
<td>201502</td>
<td><input name="member" type="checkbox" value="201502"></td>
</tr>
<tr>
<td>201503</td>
<td><input name="member" type="checkbox" value="201503"></td>
</tr>
<tr>
<td>201504</td>
<td><input name="member" type="checkbox" value="201504"></td>
</tr>
</table>
<input name="submit" type='submit' value='查找'>
</form>




第二个页面


<!--#include file="/conn.asp" -->

<%
member=trim(request("member"))
%>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>查询</title>
</head>

<body>
<%
if member<>"" then

sql="select * from t_tdd where 学号='"&member&"'"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
If Not Rs.eof then
Do While Not(rs.Eof)
%>

<%=rs("姓名")%>
<%
rs.MoveNext
Loop
end if
rs.close
set rs=nothing
end if
%>
<br />
</body>
</html>
...全文
148 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
Go 旅城通票 2015-07-24
  • 打赏
  • 举报
回复
你的学号是字符还是数字类型?而且你的是复选框。选择了多个数据格式是 xxx,xxxx,xxx....这种,要用in,不能直接=
member=trim(request("member"))

if member<>"" then
 
'sql="select * from t_tdd where 学号 in("&member&")"'''''学号数字
sql="select * from t_tdd where 学号 in('"&replace(member,",","','")&"')""''''学号字符

28,398

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧