代码如下:
<% Const adSchemaTables = 20 adSchemaColumns = 4 dim Conn,db dim ConnStr db="temp.mdb"'ACCESS数据库的文件名,请使用相对于网站根目录的的绝对路径 ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db) Set conn = Server.CreateObject("ADODB.Connection") conn.Open connstr Dim rstSchema Dim I Set rstSchema = Conn.OpenSchema(adSchemaTables) Do while not rstSchema.EOF response.write ("Table name: "& rstSchema("TABLE_NAME") & vbCr & _ "Table type: " & rstSchema("TABLE_TYPE") & vbCr) response.write(" ") I = I + 1 rstSchema.MoveNext Loop rstSchema.Close conn.Close %>