日期:2014-05-17  浏览次数:21741 次

我是新人,请高人帮我看看这代码
本意:表格显示ID为1.2.3的三条记录。如下代码执行后没有任何反应:
<%
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("download.mdb") 
set rs=server.createobject("adodb.recordset") 
sql="select * from xz where id in(1,2,3) "
rs.open sql,conn,1,1
do while not rs.eof and rowcount >0
xzdz=rs("xzdz")
xzmc=rs("xzmc")
%>
<table border="0" id="table4">
<tr>
  <td><a href="<%=xzdz%>"><%=xzmc%></a></td>
</tr>
</table>
<% 
rowcount=rowcount-1
rs.MoveNext
loop  
rs.close
set rs=nothing
%>

------解决方案--------------------
rowcount为空,所以不会>0 所以显示不出来
------解决方案--------------------
<%
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("download.mdb")
set rs=server.createobject("adodb.recordset")
sql="select * from xz where id in(1,2,3) "
rs.open sql,conn,1,1
response.write("<table border="0" id="table4">");
do while not rs.eof and rowcount >0
xzdz=rs("xzdz")
xzmc=rs("xzmc")
response.write("<tr><td><a href='<%=xzdz%>'>'<%=xzmc%>'</a></td></tr>");
rowcount=rowcount-1
rs.MoveNext
loop
response.write("</table>");
rs.close
set rs=nothing
%>
试试,
其实我没有写过ASP......