<%
Set Conn = Server.CreateObject("ADODB.Connection")
'On Error Resume Next
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("21.mdb")
'strconn="DBQ=" & server.mappath("21.mdb") & ";DRIVER={Microsoft Access Driver (*.mdb)};"
'set objconn=server.CreateObject("ADODB.connection")
'objconn.open strconn
dim rsc
set rsc=conn.openSchema(4) '所有字段
'set rsc = conn.OpenSchema(4, Array(Empty, Empty,"table1")) '针对单个表提取字段
do while not rsc.eof
Response.Write(rsc("Column_Name")&", ") '字段名
Response.Write(rsc("Data_Type")&", ") '数据类型
Response.Write(rsc("Character_Maximum_Length")&", ") '长度
Response.Write(rsc("Numeric_Precision")&", ") '精度
Response.Write(rsc("Numeric_Scale")&", ") '等级
Response.Write(rsc("Is_Nullable")&", ") '是否为空
Response.Write(rsc("description")&", ") '说明
Response.Write(rsc("Column_Default")&", ")&"<Hr>" '默认值
rsc.movenext
loop
set rs=conn.openSchema(20) '读取表为20
rs.moveFirst
do until rs.Eof
if rs("TABLE_TYPE")="TABLE" then
response.write rs("table_name") & " | " &rs("description") &"<br> "
end if
rs.movenext
loop
rs.close
%>