- <html>
- <head>
- <title>获取ACCESS数据库表名_www.tuohang.net</title>
- </head>
- <body style="text-align:left;margin-left:50px;font-family:'arial';font-size:12px">
- <form style="padding:5px;margin:5px;margin-left:0px" name="get" action="" method="post">
- 数据库路径:<input type="text" name="path" value="" size="50" />
- <input type="hidden" name="ari" value="1" />
- <input type="submit" value="查看" />
- </form>
- <hr>
- <%
- if request.form("ari")="1" and request.form("path")<>"" then
- dim conn,connstr,i,sql,rs
- on error resume next
- Connstr="DRIVER=Microsoft Access Driver (*.mdb);DBQ="+server.mappath(request.form("path"))
- Set Conn=Server.CreateObject("ADODB.Connection")
- conn.Open connstr
- If Err Then
- err.Clear
- Set Conn = Nothing
- Response.Write "数据库连接出错,请检查连接字串。"
- Response.End
- End If
- %>
- <font color=red><%=conn.connectionstring%></font><hr>
- <%
- j=0
- dim tablecount
- tablecount=0
- Set shm = conn.OpenSchema(20)
- shm.MoveFirst
- Do While Not shm.EOF
- If shm("TABLE_TYPE") = "TABLE" Then
- If Left(shm("table_name"), 1) <> "~" Then '这里过滤掉隐藏表
- j=j+1
- call GetFileds(shm("table_name"))
- End If
- End If
- shm.MoveNext
- Loop
- response.write "共有 "&j&" 个数据表!"
- else
- response.write "<h3>请输入数据库相对路径查看具体内容!</h3>"
- end if
- %>
- </body>
- </html>
- <%
- Function GetFileds(TableName)
- Set rs = server.createobject("adodb.recordset")
- Dim SQL
- SQL = "select * from " & TableName
- rs.Open SQL, conn, 1, 1
- Dim Cont
- Cont = rs.Fields.Count
- response.write "<div style=""margin-bottom:10px;padding:5px;border:1px #dddddd solid;background:#eeeeee"">"&vbcrlf
- response.write "表 <font color=red><b>"&TableName&"</b></font> 中含有"&Cont&"个字段,具体如下:<br>"&vbcrlf
- For i = 0 To Cont - 1
- dim filtype
- select case rs.fields(i).type
- case 3
- filtype="自动编号(数字)"
- case 202
- filtype="字符"
- case 203
- filtype="备注"
- case 125
- filtype="日期"
- case 11
- filtype="真/假(是/否)"
- end select
- response.write " <font color=red>"&i&"</font>--<font color=green><b>"&rs.fields(i).name&"</b></font>--"&filtype&";<br />"&vbcrlf
- Next
- response.write "</div>"&vbcrlf
- rs.Close
- set rs=nothing
- End Function
- %>
ASP获取ACCESS数据库表名及结构的代码
2019-09-20 13:38asp教程网 ASP教程
此方法可获得ACCESS数据的表名及其结构,数据类型等... 程序过滤了几个ACCESS数据库的几个隐藏表(可能是导致ACCESS数据库删除数据还会变大的原因)
延伸 · 阅读
- 2022-06-24实战搭建MySQL高可用架构(手残党表示都会了!)
- 2022-06-24Python连接数据库并批量插入包含日期记录的操作
- 2022-06-07MongoDB创建与删除数据库
- 2022-06-06NoSQL优缺点与mongoDB数据库简介
- 2022-04-29手残又删库了,binlog救了我的命……
- 2022-04-28今年一季度暴露的数据库数量创新高,Redis排第一
精彩推荐
- ASP教程
ASP GetRef 函数指针试探
近日在学习C++,看到函数指针,由于之前一直搞ASP,所以想ASP里面是否也有这个函数指针的东西,百度了一下,没有太多关于此方面的介绍,于是翻了翻...
- ASP教程
ASP实现文件上传的方法
在基于浏览器/服务器的应用环境中,在浏览器中上传各种类型的文件一直是困扰用户文件管理应用的难题之一。常用的实现方法是利用在RFC1867中引入的一...
- ASP教程
ASP常用函数:HTMLDecode
ASP常用函数:HTMLDecode ...
- ASP教程
ASP 判断是否有中文的代码
其实我上一篇写的js判断中文才是最好的方法,这个是asp的一种,只要是双字节都是当作中文判断...
- ASP教程
asp中一段防SQL注入的通用脚本
asp中一段防SQL注入的通用脚本...
- ASP教程
asp读取远程文件并保存到本地代码
asp读取远程文件并保存到本地代码 ...
- ASP教程
字符批量替换程序asp服务器版
字符批量替换程序asp服务器版,安装方法:直接把replace.asp文件放在任意的支持asp+FSO的环境中 ...
- ASP教程
asp删除mssql数据库中没有记录的图片代码
asp删除没有记录的图片需要文件夹(存放图片的文件夹)中的每个图片和数据库中的所有记录进行比较...