本文主要是介绍不用ADOX也可以判断access表是否存在,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
哈哈,不用ADOX也可以!!
<%
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 -->系统表sysobjects
access---》用ADOX的 例子:
<%
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
%>
这篇关于不用ADOX也可以判断access表是否存在的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!