【100分_菜鸟提问】兄弟们,帮忙看看这两段代码,关于数据调用
<%
sql="select top 6 s_name,id from info_shop where ifhome=1 and ifvalid=1 order by id desc"
rs.open sql,conn,1,1
sn=0
If not rs.eof Then
do while not rs.eof
sid=rs("id")
set rs2=server.createobject("adodb.recordset")
sqltt="select top 1 sid,id,disc from dazhe_info where sid='"&sid&"' order by id desc"
rs2.open sqltt,conn,1,1
set rs1=server.createobject("adodb.recordset")
sqlt="select top 1 sid,spic from pic_shop where sid='"&sid&"' order by id desc"
rs1.open sqlt,conn,1,1
sn=sn+1
%> <td>
<table width="100" cellspacing="0" cellpadding="0" style="border:0px solid #EDE8D1;"<%if sn mod 2=0 then response.write "align=center"%>>
<td width="100" height="90" align="center"><%if not rs2.eof then%><a href="show.asp?id=<%=rs2("id")%>" target="_blank"><%else%><a href="show.asp?id=<%=rs("id")%>" target="_blank"><%end if%><%if not rs1.eof then%><img src='imgweb/<%=rs1("spic")%>' width="95" height="75" border="0" style="border:1px solid #CCC;">
<%else%><img src='imgweb/noimg.gif' width="95" height="75" border="0">
<%end if%>
<%if not rs2.eof then%>
<a href="show.asp?id=<%=rs2("id")%>" target="_blank">
<%else%>
<a href="show.asp?id=<%=rs("id")%>" target="_blank">
<%end if%>
<font color="#FF3300"><%=rs("s_name")%></font></a></td>
</table>
<%
rs1.close
rs2.close
if sn mod 2 =0 then
response.write "<tr>"
end if
rs.movenext
loop%>
</table>
<%
End If
rs.close
%>
</td>
</tr>
<tr>
<td><img src="images/zxdz_b.jpg" width="362" height="7" /></td>
</tr>
</table>【上面这段代码能够正常调用最新的数据,但一换成下面的,就不能显示,有那个兄弟能够帮帮忙,看看下面那段代码为什么不能显示?????】
<%
dim zs:zs = 9 '===== 提取的文章数量
dim cols:cols = 3 '==== 列数sn = 0
sql="select top "&zs&" id,s_name from info_shop where ifhome=1 and ifvalid=1 order by id asc"
rs.open sql,conn,1,1
if not rs.eof then
do while not rs.eof
sn = sn + 1sid=rs("id")
set rs2=server.createobject("adodb.recordset")
sqltt="select top 1 sid ,id from dazhe_info where sid='"&sid&"' order by id desc"
rs2.open sqltt,conn,1,1
If not rs2.eof Then '--1set rs1=server.createobject("adodb.recordset")
sqlt="select top 1 sid ,spic from pic_shop where sid='"&sid&"' order by id desc"
rs1.open sqlt,conn,1,1
%>
<td width="33%"><table width="96" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><div align="center">
<table width="87" border="0" cellpadding="0" cellspacing="0">
<tr bgcolor="#CFCFCF">
<td colspan="3" height="1"></td>
</tr>
<tr>
<td width="1" bgcolor="#CFCFCF" height="11"></td>
<td height="55"><div align="center"><a href="show.asp?id=<%=rs2("id")%>" target="_blank" >
<%if not rs1.eof then
%>
<img src='imgweb/<%=rs1("spic")%>' width="102" height="68" border="0" />
<%else%>
<img src='imgweb/noimg.gif' width="102" height="68" border="0" />
<%end if%>
</a></div></td>
<td width="5" bgcolor="#CFCFCF" height="11"></td>
</tr>
<tr bgcolor="#CFCFCF">
<td colspan="3"
height="1"></td>
</tr>
</table>
</div></td>
</tr>
<tr>
<td height="20" width="102"><div align="center"><a href="show.asp?id=<%=rs2("id")%>" target="_blank">
<% if len(rs("s_name"))>8 then%>
</a><a href="show.asp?id=<%=rs2("id")%>" target="_blank"><%=left(rs("s_name"),8)%></a><a href="show.asp?id=<%=rs2("id")%>" target="_blank">
<% else%>
<%=rs("s_name")%>
<%end if%>
</a></div></td>
</tr>
</table></td>
<%
rs1.close
End If '--1
rs2.closeIf sn = cols Then
sn = 0
Response.Write("</tr><tr align=center valign=top>")
End If
rs.movenext
Loop
end if
rs.close
%>
</tr>
</table></td>
</tr>
<tr>
<td><img src="images/zxdz_b.jpg" width="362" height="7" /></td>
</tr>
</table>
<%
sql="select top 6 s_name,id from info_shop where ifhome=1 and ifvalid=1 order by id desc"
rs.open sql,conn,1,1
sn=0
If not rs.eof Then
do while not rs.eof
sid=rs("id")
set rs2=server.createobject("adodb.recordset")
sqltt="select top 1 sid,id,disc from dazhe_info where sid='"&sid&"' order by id desc"
rs2.open sqltt,conn,1,1
set rs1=server.createobject("adodb.recordset")
sqlt="select top 1 sid,spic from pic_shop where sid='"&sid&"' order by id desc"
rs1.open sqlt,conn,1,1
sn=sn+1
%> <td>
<table width="100" cellspacing="0" cellpadding="0" style="border:0px solid #EDE8D1;"<%if sn mod 2=0 then response.write "align=center"%>>
<td width="100" height="90" align="center"><%if not rs2.eof then%><a href="show.asp?id=<%=rs2("id")%>" target="_blank"><%else%><a href="show.asp?id=<%=rs("id")%>" target="_blank"><%end if%><%if not rs1.eof then%><img src='imgweb/<%=rs1("spic")%>' width="95" height="75" border="0" style="border:1px solid #CCC;">
<%else%><img src='imgweb/noimg.gif' width="95" height="75" border="0">
<%end if%>
<%if not rs2.eof then%>
<a href="show.asp?id=<%=rs2("id")%>" target="_blank">
<%else%>
<a href="show.asp?id=<%=rs("id")%>" target="_blank">
<%end if%>
<font color="#FF3300"><%=rs("s_name")%></font></a></td>
</table>
<%
rs1.close
rs2.close
if sn mod 2 =0 then
response.write "<tr>"
end if
rs.movenext
loop%>
</table>
<%
End If
rs.close
%>
</td>
</tr>
<tr>
<td><img src="images/zxdz_b.jpg" width="362" height="7" /></td>
</tr>
</table>【上面这段代码能够正常调用最新的数据,但一换成下面的,就不能显示,有那个兄弟能够帮帮忙,看看下面那段代码为什么不能显示?????】
<%
dim zs:zs = 9 '===== 提取的文章数量
dim cols:cols = 3 '==== 列数sn = 0
sql="select top "&zs&" id,s_name from info_shop where ifhome=1 and ifvalid=1 order by id asc"
rs.open sql,conn,1,1
if not rs.eof then
do while not rs.eof
sn = sn + 1sid=rs("id")
set rs2=server.createobject("adodb.recordset")
sqltt="select top 1 sid ,id from dazhe_info where sid='"&sid&"' order by id desc"
rs2.open sqltt,conn,1,1
If not rs2.eof Then '--1set rs1=server.createobject("adodb.recordset")
sqlt="select top 1 sid ,spic from pic_shop where sid='"&sid&"' order by id desc"
rs1.open sqlt,conn,1,1
%>
<td width="33%"><table width="96" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><div align="center">
<table width="87" border="0" cellpadding="0" cellspacing="0">
<tr bgcolor="#CFCFCF">
<td colspan="3" height="1"></td>
</tr>
<tr>
<td width="1" bgcolor="#CFCFCF" height="11"></td>
<td height="55"><div align="center"><a href="show.asp?id=<%=rs2("id")%>" target="_blank" >
<%if not rs1.eof then
%>
<img src='imgweb/<%=rs1("spic")%>' width="102" height="68" border="0" />
<%else%>
<img src='imgweb/noimg.gif' width="102" height="68" border="0" />
<%end if%>
</a></div></td>
<td width="5" bgcolor="#CFCFCF" height="11"></td>
</tr>
<tr bgcolor="#CFCFCF">
<td colspan="3"
height="1"></td>
</tr>
</table>
</div></td>
</tr>
<tr>
<td height="20" width="102"><div align="center"><a href="show.asp?id=<%=rs2("id")%>" target="_blank">
<% if len(rs("s_name"))>8 then%>
</a><a href="show.asp?id=<%=rs2("id")%>" target="_blank"><%=left(rs("s_name"),8)%></a><a href="show.asp?id=<%=rs2("id")%>" target="_blank">
<% else%>
<%=rs("s_name")%>
<%end if%>
</a></div></td>
</tr>
</table></td>
<%
rs1.close
End If '--1
rs2.closeIf sn = cols Then
sn = 0
Response.Write("</tr><tr align=center valign=top>")
End If
rs.movenext
Loop
end if
rs.close
%>
</tr>
</table></td>
</tr>
<tr>
<td><img src="images/zxdz_b.jpg" width="362" height="7" /></td>
</tr>
</table>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货