注册 登录
编程论坛 ASP技术论坛

asp实现从两个表中联合查询的错误,急请高手??

天上的星 发布于 2009-10-03 09:30, 998 次点击
<!--#include file="conn.asp" -->
<table ><%
set rs=server.CreateObject("adodb.recordset")
sql="select * from jxj where xh in (select xh from student )" '一个学生表student,另一个是奖学金表jxj,两个表中有共同的字段xh
rs.open sql,conn,1,1
%>
<%do while not rs.eof%>
<tr>
    <td>

<li><%=rs("xh")%><%=rs("xm")%></li>'
<%
rs.movenext
loop
%>
</td>
</tr>
</table>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
为什么他总是输出不了错误,也没提示,页面缓冲很慢,一直没有结果!最后只能脚本运行时间过长!谢谢高手们!
6 回复
#2
天上的星2009-10-03 23:42
本来就没错!
#3
chenguoxing5172009-10-13 16:29
<li><%=rs("xh")%><%=rs("xm")%></li>'
改为
<li><%=rs("xh")%><%=rs("xm")%></li>
#4
孤独冷雨2009-10-14 08:44
如果页面只有这么一段代码,你数据库两张表的相同字段类型相同,而又出现你所说的那种情况,你检察一下你conn.asp是否有错,

整段代码没有错!
#5
chenbofeng202009-10-14 09:06
sql="select * from jxj where jxj.xh=student.xh"
#6
keybord2009-10-15 20:08
是不是数据库的问题
#7
xpowoow2009-10-17 00:33
<!--#include file="conn.asp" -->
<table ><%
set rs=server.CreateObject("adodb.recordset")
sql="select * from jxj where xh in (select xh from student )" '一个学生表student,另一个是奖学金表jxj,两个表中有共同的字段xh
rs.open sql,conn,1,1

%>
<%

if not rs.eof then '加这条语句判断记录

do while not rs.eof

%>
<tr>
    <td>
 
<li><%=rs("xh")%><%=rs("xm")%></li>

</td>

<%   
rs.movenext   
loop   
else
%>  
查询没有数据!
<%end if%>


</tr>
</table>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
1