佳木斯湛栽影视文化发展公司

主頁 > 知識庫 > ASP獲取ACCESS數(shù)據(jù)庫表名及結(jié)構(gòu)的代碼

ASP獲取ACCESS數(shù)據(jù)庫表名及結(jié)構(gòu)的代碼

熱門標(biāo)簽:團購網(wǎng)站 銀行業(yè)務(wù) 電子圍欄 Linux服務(wù)器 服務(wù)器配置 阿里云 科大訊飛語音識別系統(tǒng) Mysql連接數(shù)設(shè)置

html>
head>
title>獲取ACCESS數(shù)據(jù)庫表名_www.jb51.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">
數(shù)據(jù)庫路徑: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 "數(shù)據(jù)庫連接出錯,請檢查連接字串。"
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" 個數(shù)據(jù)表!"
else
response.write "h3>請輸入數(shù)據(jù)庫相對路徑查看具體內(nèi)容!/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="自動編號(數(shù)字)"
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
%>

標(biāo)簽:衡水 大理 棗莊 萍鄉(xiāng) 蚌埠 江蘇 衢州 廣元

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《ASP獲取ACCESS數(shù)據(jù)庫表名及結(jié)構(gòu)的代碼》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266
    高碑店市| 崇义县| 石台县| 谢通门县| 灵武市| 大连市| 米泉市| 邵东县| 舒兰市| 奈曼旗| 馆陶县| 营山县| 大安市| 濉溪县| 轮台县| 淮南市| 江川县| 区。| 闵行区| 华蓥市| 雅安市| 奈曼旗| 青浦区| 锡林郭勒盟| 岚皋县| 苍梧县| 淮北市| 南昌市| 涡阳县| 敖汉旗| 唐山市| 天峻县| 廉江市| 天台县| 泸水县| 攀枝花市| 竹溪县| 手机| 岳普湖县| 涿州市| 乐东|