ASP get access system tables, query and other operation code _ application Tips

Source: Internet
Author: User
Tags access database
Method One: Open adschematables directly with ADO OpenSchema () method, establish a schema recordset


Code:
<%
Const adSchemaTables = 20
adSchemaColumns = 4
Dim conn,db
Dim connstr
db= the file name of the "Temp.mdb" Access database, use an absolute path relative to the site root
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 as 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 Two: Access system table msysobjects contains a list of database objects. Although not documented in the document, you can still query it to get what you want. However, by default, the operating system table is not available and you must manually set permissions to query the system tables.
Please refer to the following animation: How to get permission to operate on Msysobject http://blog.iyi.cn/user/david/archives/IMAGES/msobject.swf

But I can't find these system tables in access2003 and I don't know if it's m$ enhanced access security.

Use the following SQL statement to get what you want


Code:
Inquire:
SELECT msysobjects.name from Msysobjects WHERE ([name],1) <> ' ~ ') and (Msysobjects.type) =5 ORDER by msysobjects . Name;


Form:
SELECT msysobjects.name from Msysobjects WHERE ([name],1) <> ' ~ ') and (Msysobjects.type) =-32768 ORDER BY Msysobjects.name;


Table:
SELECT msysobjects.name from Msysobjects WHERE ([name],1) <> "~") and (left$ ([name],4) <> "Msys") and (MSy Sobjects.type) =1 order by Msysobjects.name;


Report:
SELECT msysobjects.name from Msysobjects WHERE ([name],1) <> ' ~ ') and (msysobjects.type) = -32764 ORDER by Msysob Jects. Name;


Module:
SELECT msysobjects.name from Msysobjects WHERE ([name],1) <> ' ~ ') and (msysobjects.type) = -32761 ORDER by Msysob Jects. Name;


Macro:
SELECT msysobjects.name from Msysobjects WHERE ([name],1) <> ' ~ ') and (msysobjects.type) = -32766 ORDER by Msysob Jects. Name;
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.