| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1775 人关注过本帖
标题:[求助]ASP多表查询问题
只看楼主 加入收藏
ml3300
Rank: 1
等 级:新手上路
帖 子:27
专家分:0
注 册:2006-4-16
收藏
得分:0 

是啊,变量错了,呵呵,现在好了。
<!--#include file="conn.asp"-->
<%
if session("user")="" then
response.write "您无此权限"
response.end
end if

%>

<%
T1 = trim(request("T1"))
T2 = trim(request("T2"))
T3 = trim(request("T3"))
T4=request("kecm")

if T1 = "" then
conn.close
set conn = nothing
response.write "<script>alert('请输入起始分数');history.go(-1);</script>"
response.end
end if
if T2 = "" then
conn.close
set conn = nothing
response.write "<script>alert('请输入结束分数');history.go(-1);</script>"
response.end
end if
if T3 = "" then
conn.close
set conn = nothing
response.write "<script>alert('请输入每班级人数');history.go(-1);</script>"
response.end
end if

if T1 > T2 then
response.write "<script>alert('起始分数要低于结束分数');history.go(-1);</script>"
response.end

end if

%>

<%dim cno
sqla = "select * from subject where 课题名称 ='"&T4&"'"
set aa = server.createobject("adodb.recordset")
aa.open sqla,conn,1,1
cno=aa("选题编号")

sql = "select * from student where xtbh = '"&cno&"'and student.cj between'"&T1&"' and '"&T2&"' order by 专业"
set rst = server.createobject("adodb.recordset")
rst.open sql,conn,1,1
%>
<html>
<head>

<title>分班结果</title>
<link rel="stylesheet" href="style.css">
</head>

<body topmargin="0">
<!--#include file="top.asp"-->
<%
if Not(rst.bof and rst.eof) then'判别数据表中是否为空记录
NumRecord=rst.recordcount
rst.pagesize=T3
NumPage=rst.Pagecount
if request("page")=empty then
NoncePage=1
else
if Cint(request("page"))<1 then
NoncePage=1
else
NoncePage=request("page")
end if
if Cint(Trim(request("page")))>Cint(NumPage) then NoncePage=NumPage
end if
else
NumRecord=0
NumPage=0
NoncePage=0
end if
%>

<div align="center">
<table width="760" height="35" cellspacing="0" cellpadding="0">
<td background="images/top_1.jpg">
<p align="center"> <b><font size="3">此为本课程</font><font size="5" color="#FF0000"><%=NoncePage%></font><font size="3">班学生名单</font></table>
</div>
<div align="center">
<center>
<table border="0" width="700" cellspacing="0" cellpadding="0">

<table border="1" width="760" bordercolorlight="#000000" cellspacing="1" cellpadding="5" bordercolordark="#FFFFFF" height="33">
<tr>

<td width="56" bgcolor="#EBE9FE" align="center" height="11">学号</td>
<td width="116" bgcolor="#EBE9FE" align="center" height="11">姓名</td>
<td width="118" bgcolor="#EBE9FE" align="center" height="11">专业</td>
<td width="249" bgcolor="#EBE9FE" align="center" height="11">所选课程</td>
<td width="77" bgcolor="#EBE9FE" align="center" height="11">联系方式</td>
<td width="76" bgcolor="#EBE9FE" align="center" height="11">成绩</td>
</tr>
<%if Not(rst.bof and rst.eof) then
rst.move (Cint(NoncePage)-1)*T3,1
for i=1 to rst.pagesize
%>

<tr>

<td width="56" align="center" height="1"><%=rst("学号")%></td>
<td width="116" align="center" height="1"><%=rst("姓名")%></td>
<td width="118" align="center" height="1"><%=rst("专业")%></a></td>
<td width="249" align="center" height="1"><%=T4%></td>
<td width="77" align="center" height="1"><%=rst("电话")%></a></td>
<td width="76" align="center" height="1"><%=rst("cj")%></td>
</tr>
<% rst.movenext
if rst.eof then exit for
next
response.write i
else
response.write "<tr><td colspan=13><marquee scrolldelay=120 behavior=alternate>没有找到任何记录!!!</marquee></td></tr>"
end if

rst.close
set rst=nothing

%>

</table>
</table>
</div>
<div align="center">
<table width="760" border="0">
<tr>
<td height="17">

<div align="right">
<input type="hidden" name="page" value="<%=NoncePage%>">
<%
if NoncePage>1 then
response.write "|<a href=fenban1.asp?page=1&T1="&T1&"&T2="&T2&"&T3="&T3&"&kecm="&t4&">首 页</a>| |<a href=fenban1.asp?page="&NoncePage-1&"&T1="&T1&"&T2="&T2&"&T3="&T3&"&kecm="&t4&">上一页</a>|&nbsp"
else
response.write "|首 页| |上一页|&nbsp"
end if
if Cint(Trim(NoncePage))<Cint(Trim(NumPage)) then
response.write "|<a href=fenban1.asp?page="&NoncePage+1&"&T1="&T1&"&T2="&T2&"&T3="&T3&"&kecm="&t4&">下一页</a>| |<a href=fenban1.asp?page="&NumPage&"&T1="&T1&"&T2="&T2&"&T3="&T3&"&kecm="&t4&">尾 页</a>|"
else
response.write "|下一页| |尾 页|"
end if
%>
&nbsp;页次:<font color="#0033CC"><%=NoncePage%></font>/<font color="#0033CC"><%=NumPage%></font>
共<font color="#0033CC"><%=NumRecord%></font>条记录&nbsp; </div>
</td>

</table>
<%
aa.close
set aa=nothing

%>
</div>
</center>
<!--#include file="down.asp"-->
</body>

</html>

2007-05-08 16:16
快速回复:[求助]ASP多表查询问题
数据加载中...
 
   



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

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