Method 1: Open adSchemaTables directly using the OpenSchema () method of ado and create a schema record set.
Code:
<%
Const adSchemaTables = 20
AdSchemaColumns = 4
Dim Conn, db
Dim ConnStr
Db = "temp. mdb" 'Access database file name, use the absolute path relative to the website root directory
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 ("<br/> ")
I = I + 1
RstSchema. MoveNext
Loop
RstSchema. Close
Conn. Close
%>
Method 2: The Access System Table MsysObjects contains a list of database objects. Although it is not recorded in the document, you can query it to obtain what you want. However, the system table cannot be operated by default. You must manually set the permission to receive the table.
See the following Animation: how to get the http://blog.iyi.cn/user/david/archives/IMAGES/msobject.swf for msysobject operation Permissions
However, I cannot find these system tables in access2003. I don't know if m $ enhances access security.
Use the following SQL statement to obtain
Code:
Query:
SELECT MSysObjects. Name FROM MsysObjects WHERE (Left ([Name], 1) <> "~ ") AND (MSysObjects. Type) = 5 order by MSysObjects. Name;
Form:
SELECT MSysObjects. Name FROM MsysObjects WHERE (Left ([Name], 1) <> "~ ") AND (MSysObjects. Type) =-32768 order by MSysObjects. Name;
Table:
SELECT MSysObjects. Name FROM MsysObjects WHERE (Left ([Name], 1) <> "~ ") AND (Left $ ([Name], 4) <>" Msys ") AND (MSysObjects. Type) = 1 order by MSysObjects. Name;
Report:
SELECT MSysObjects. Name FROM MsysObjects WHERE (Left ([Name], 1) <> "~ ") AND (MSysObjects. Type) =-32764 order by MSysObjects. Name;
Module:
SELECT MSysObjects. Name FROM MsysObjects WHERE (Left ([Name], 1) <> "~ ") AND (MSysObjects. Type) =-32761 order by MSysObjects. Name;
MACRO:
SELECT MSysObjects. Name FROM MsysObjects WHERE (Left ([Name], 1) <> "~ ") AND (MSysObjects. Type) =-32766 order by MSysObjects. Name;