Python语言技术文档

微信小程序技术文档

php语言技术文档

jsp语言技术文档

asp语言技术文档

C#/.NET语言技术文档

html5/css技术文档

javascript

点击排行

您现在的位置:首页 > 技术文档 > asp入门教程

asp获取ACCESS数据库表名及结构的代码

来源:中文源码网    浏览:211 次    日期:2024-05-03 22:01:53
【下载文档:  asp获取ACCESS数据库表名及结构的代码.txt 】


ASP获取ACCESS数据库表名及结构的代码
获取ACCESS数据库表名_www.zwyuanma.com
数据库路径:

<% 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 %> <%=conn.connectionstring%>
<% 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 "

请输入数据库相对路径查看具体内容!

" end if %> <% 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 "
"&vbcrlf response.write "表 "&TableName&" 中含有"&Cont&"个字段,具体如下:
"&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 " "&i&"--"&rs.fields(i).name&"--"&filtype&";
"&vbcrlf Next response.write "
"&vbcrlf rs.Close set rs=nothing End Function %>

相关内容