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

asp连接ACCESS数据库,读取前四条数据不能读出

CYCcaoyanchu 发布于 2012-07-14 14:34, 604 次点击
<%

       set rs = server.CreateObject("adodb.recordset")

     sql = "select top 4 title,shijian from news order by id desc"

     rs.open sql,conn,1,1

     %>

              <li>

                <dd><a href="#"><%=rs("title")%></a></dd>

                <dt><%=rs("shijian")%></dt>

              </li>

              <%

     rs.close

     conn.close

     set rs = nothing

     set conn = nothing

    %>

这个只能读取一条,我在中间加上 if not rs.eof then 这段代码和

rs.movenext

     loop

这段代码又要报错!!!
1 回复
#2
xmlz2012-07-14 14:55
4条记录都取出来了
只是要循环输出
do while not rs.eof
...
rs.movenext
loop
1