< !-- #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)&" b>< 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
% >