asp+access遍历.mdb指定数据表的字段结构

 

asp+access遍历.mdb指定数据表的字段结构

 

<%
    'On Error resume next

table = "chengji"   '需要显示的表
datas = "20181018.mdb"   '数据库相对路径
set conn=Server.CreateObject("ADODB.Connection")
conn.open "DRIVER=Driver do Microsoft Access (*.mdb);UID=admin;PWD=;DBQ="&Server.MapPath(""&datas&"")
If Err Then
err.Clear
response.write "数据库连接出错,请检查连接字串(1)"&vbcrlf
response.End()
End If


        sql="select * from "&table&""
        set rs=server.createobject("adodb.recordset")
        rs.open sql,conn,3,2
            response.write "

字段遍历 "&table&":

" &vbcrlf For i=0 to rs.fields.count-1 Response.Write ""& rs(i).Name &"
" 'Response.Write ""&rs(i).Type&","&rs(i).definedsize&"
" Next rs.close set rs = nothing %>

 

你可能感兴趣的:(asp,access)