< !-- #include file="conn.ASP" -- >
< %
'功能:顯示數據庫中表名、字段名
'原創:wangsdong
'來源:www.ASPprogram.cn
'原創文章,轉載請保留此信息,謝謝
Set rs=Conn.OpenSchema(20)
Do Until rs.EOF
If rs(3)="TABLE" Then
response.write "< b>表名:"&rs(2)&"< br />"
Set rs1=server.CreateObject("adodb.recordset")
sql="select * from ["&rs(2)&"]"
response.write sql&"< br>"
Set rs1=conn.execute(sql)
response.write "字段名:"
str=""
For i=0 To rs1.fIElds.count-1
str=str&rs1.fIElds(i).name&","
Next
response.write left(str,len(str)-1)
response.write "< br />< br>"
End If
rs.MoveNext
Loop
Set rs=Nothing
Set conn=nothing
% >