You can also tell if an Access table exists without ADOX

Source: Internet
Author: User
Tags access
access|ado| whether exist haha, do not ADOX also can!!








<%





Dim cn, Strcnn,rstschema





Set cn = Server.CreateObject ("ADODB.") Connection ")


Set strcnn = Server.CreateObject ("ADODB. Recordset ")


Set Rstschema = Server.CreateObject ("ADODB. Recordset ")





strcnn = "provider=microsoft.jet.oledb.4.0;"


strcnn = strcnn & "Data Source=f:\asptest\tree. MDB; "


strcnn = strcnn & "Persist security Info=false"





CN. Open strcnn





set Rstschema=cn.openschema (20)


Rstschema.movefirst


do Until rstschema.eof


if Rstschema ("table_type") = "TABLE" then


Response.Write Rstschema ("table_name") & "<br/>"


End If


Rstschema.movenext


Loop


Cn.close





' Set Rstschema = Nothing


' Set cn = Nothing


%>





SQL--> system table sysobjects





Access---in adox example:





<%





Dim cn, strcnn





Set cn = Server.CreateObject ("ADODB.") Connection ")


Set strcnn = Server.CreateObject ("ADODB. Recordset ")








strcnn = "Provider=Microsoft.Jet.OLEDB.4.0;Data source=f:\asptest\tree." MDB; Persist Security Info=false "





CN. Open strcnn


Set TB = Server.CreateObject ("ADOX. Table ")


Set cat = Server.CreateObject ("ADOX.") Catalog ")


Set Cat. ActiveConnection = cn





for each a in cat. Tables


Response.Write A.name & "<br>"


Next





Cn.close


%>














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.