如何显示一个表(ACCESS)

类别:Asp 点击:0 评论:0 推荐:
<%sub Table_show(tablename)%>
   <table  border="1" cellspacing="0" cellpadding="3" style='border-collapse:collapse;' bordercolor="#006699">
   <%
   set rs=server.CreateObject("adodb.recordset")
   sql="select * from "&tablename
   rs.open sql,conn,1,1
   %> 
     <tr>
   <%for i=0 to rs.fields.count-1%> 
    <td><%=rs.fields(i).name%></td>
   <%next%> 
     </tr>
   <%do while not rs.eof%> 
     <tr>
   <%for i=0 to rs.fields.count-1%> 
    <td><%=rs(i)%></td>
   <%next%> 
     </tr>
   <%rs.movenext
   loop
   rs.close
   set rs=nothing%> 
   </table>   
<%end sub%>

本文地址:http://com.8s8s.com/it/it7061.htm