查看数据库中表、视图等

发表于:2007-06-21来源:作者:点击数: 标签:
html head meta http-equiv="Content-Type" content="text/html; charset=gb2312" title查看 数据库 中表、视图等/title !-- #INCLUDE FILE="ADO VB S.INC" -- /head body % Dim Conn Dim RS Set Conn = Server.CreateObject("ADODB.Connection") Dim connst

   
  <html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>查看数据库中表、视图等</title>
<!-- #INCLUDE FILE="ADOVBS.INC" -->
</head>

<body>
<%
    Dim Conn
    Dim RS
    Set Conn = Server.CreateObject("ADODB.Connection")
    Dim connstr
    connstr = "DBQ="+server.mappath("webdb.mdb")+";DefaultDir=;DRIVER={Microsoft Aclearcase/" target="_blank" >ccess Driver (*.mdb)};DriverId=25;FIL=MS Access;ImplicitCommitSync=Yes;MaxBufferSize=512;MaxScanRows=8;PageTimeout=5;SafeTransactions=0;Threads=3;UserCommitSync=Yes;"
    'connstr = "DSN=Sql;UID=sa;PWD=;DATABASE=master"
    Conn.CursorLocation = adUseClient
    Conn.Open connstr
    Set RS = Conn.OpenSchema(adSchemaTables)
    %>
<div align="center"><center>
<table border="1">
  <tr>
    <td>库名</td>
    <td>表名</td>
    <td>所有者</td>
    <td>类型</td>
    <td>描述</td>
  </tr>
    <%
    Do Until RS.EOF
        %>
  <tr>
    <td><% = RS("TABLE_CATALOG") %></td>
    <td><% = RS("TABLE_NAME") %></td>
    <td><% = RS("TABLE_SCHEMA") %></td>
    <td><% = RS("TABLE_TYPE") %></td>
    <td><% = RS("DESCRIPTION") %></td>
  </tr>
        <%
        RS.MoveNext
    Loop
%>
</table>
</center></div>
<p>在ACCESS、Microsoft SQL SERVER、IIS4、PWS4中均可运行。<br>
还有一个更直观的办法哟,就是直接用SQL语句<br>
Access: select * from MSysObjects;<br>
SQL Server: select * from dbo.sysobjects<br>
Oracle: select * from tab;<br>
不过如果你不加限制条件的话,就会一股脑儿把存储结构呀,模块呀什么的全都查出来了<br>
露茜 1999年1月17日</p>
</body>
</html>

原文转自:http://www.ltesting.net