當前位置:開發者網絡 >> 技術教程 >> ASP教程 >> 數據庫相關 >> 內容
精彩推薦
分類最新教程
分類熱點教程
    
如何顯示一個數據庫裡的所有表(ACCESS)
作者:未知
日期:2005-04-19
人氣:
投稿:(轉貼)
來源:未知
字體:
收藏:加入瀏覽器收藏
以下正文:
使用這個過程的前提條件是要在調用前寫好數據庫連接的代碼。
一般為<!--#include file="conn.asp"-->
<%sub Schema_show()%>
   <table  border="1" cellspacing="0" cellpadding="3" style=’border-collapse:collapse;’ bordercolor="#006699">
   <%
   set rs=Conn.openSchema(20) 
   rs.movefirst
   %> 
     <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>
     <%if rs.fields(i).name="TABLE_NAME" and (rs("TABLE_TYPE")="TABLE" or rs("TABLE_TYPE")="VIEW") then%>
     <a href="?table=<%=rs(i)%>"><%=rs(i)%></a>
     <%else%>
     <%=rs(i)%>
     <%end if%>
    </td>
   <%next%> 
     </tr>
   <%rs.movenext
   loop
   rs.close
   set rs=nothing%>  
   </table>   
<%end sub%>
相關文章: