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

将查询到的数据添加到设定的表格

j04116 发布于 2014-03-01 08:34, 550 次点击
将查询到的数据添加到设定的表格,此表格要求根据数据记录数 动态增加行数,请各位帮忙
3 回复
#2
hu9jj2014-03-01 08:51
这应该是最基本的操作,利用循环来动态添加行数。
下面的代码可供参考:

      <table border="2" width="100%" bordercolor="#00AEEF">
        <tr>
          <td width="90" background="images/base/back9.gif" align="center" height="28">日期</td>
          <td width="810" background="images/base/back9.gif" align="center" height="28">主&nbsp;&nbsp;题&nbsp;&nbsp; 及&nbsp;&nbsp;内&nbsp;&nbsp; 容</td>   
        </tr>
        <%
        rs.open "select * from mywb where wzlb="&(txtid)&" order by wbdt desc",conn,1,1
        do while not rs.eof %>
        <tr>
          <td width="896" align="center" height="16" colspan="2">
            <table border="0" width="100%" cellpadding="2">
              <tr>
                <td width="86" rowspan="2" bgcolor="#D0EFFF">
                   <p align="center"><% =rs("wbdt") %></td>
                <td width="810" bgcolor="#D0EFFF"><font color="#0000FF">
                  <p align="center"><% =rs("wzbt") %></font></td>
              </tr>
              <tr>
                <td width="810"><% =Replace(Replace(rs("wzrr"),vbCrLf,"<br>")," ","&nbsp;") %></td>
              </tr>
            </table>
          </td>
        </tr>
        <%
         rs.movenext
         loop
        rs.close
        set rs=nothing
        %>
      </table>

[ 本帖最后由 hu9jj 于 2014-3-1 08:53 编辑 ]
#3
j041162014-03-01 09:30
回复 2楼 hu9jj
 谢谢,管用
#4
hu9jj2014-03-01 17:01
试试不就知道了么
1