当前位置: 代码网 > it编程>编程语言>其他编程 > 如何显示数据库的结构?

如何显示数据库的结构?

2024年05月15日 其他编程 我要评论
<html><head><meta http-equiv="content-type" content="text/html; charset=gb2312">&l

<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#cccccc" text="#000000">
<h2 align="center">
星河影动之查看数据库结构</h2>
<p>
<%
on error resume next
table=request("table")
 ' 获得表名.


if table<>"" then
response.write "
数据表:"&table
set primary = con.openschema(adschemaprimarykeys, _
array(empty, empty, table))
if primary("column_name")<>"" then
primarykey=primary("column_name")
end if
primary.close
set primary=nothing
%>
</p>
<center>
<table width="650" border="1" cellpadding="0" cellspacing="0">
<tr bgcolor="#cccccc">
<th class="sundog" width="61">
<div align="center">
字段</div>
</th>
<th class="sundog" width="131">
<div align="center">
类型</div>
</th>
<th class="sundog" width="105">
<div align="center">
设定大小</div>
</th>
<th class="sundog" width="69">
<div align="center">
允许空值</div>
</th>
<th class="sundog" width="69">
自动编号
</th>
<th class="sundog" width="81">
主键</th>
</tr>
<%sql="select * from ["&table&"] "
set rs=con.execute(sql)
for i=0 to rs.fields.count-1
%>
<tr bgcolor="#cccccc">
<td class="sundog" height="2" width="61">
<div align="center"><%=rs(i).name%></div>


----------------------------------------------------------------------------------------------------------------

 ' 字段名.

</td>
<td class="sundog" height="2" width="131">
<div align="center">
<%
field_type=rs(i).type
select case field_type
case adempty
typ = "empty"
case adtinyint
typ = "tinyint"
case adsmallint
typ = "smallint"
case adinteger
typ = "integer"
case adbigint
typ = "bigint"
case adunsignedtinyint
typ = "unsignedtinyint"
case adunsignedsmallint
typ = "unsignedsmallint"
case adunsignedint
typ = "unsignedint"
case adunsignedbigint
typ = "unsignedbigint"
case adsingle
typ = "single"
case addouble
typ = "double"
case adcurrency
typ = "currency"
case addecimal
typ = "decimal"
case adnumeric
typ = "numeric"
case adboolean
typ = "boolean"
case aderror
typ = "error"
case aduserdefined
typ = "userdefined"
case advariant
typ = "variant"
case adidispatch
typ = "idispatch"
case adiunknown
typ = "iunknown"
case adguid
typ = "guid"
case addate
typ = "date"
case addbdate
typ = "dbdate"
case addbtime
typ = "dbtime"
case addbtimestamp
typ = "dbtimestamp"
case adbstr
typ = "bstr"
case adchar
typ = "char"
case advarchar
typ = "varchar"
case adlongvarchar
typ = "longvarchar"
case adwchar
typ = "wchar"
case advarwchar
typ = "varwchar"
case adlongvarwchar
typ = "longvarwchar"
case adbinary
typ = "binary"
case advarbinary
typ = "varbinary"
case adlongvarbinary
typ = "longvarbinary"
case adchapter
typ = "chapter"
case adpropvariant
typ = "propvariant"
case else
typ = "unknown"
----------------------------------------------------------------------------------------------------------------

 

end select
response.write typ%>
 ' 字段类型.
</div>
</td>
<td class="sundog" height="2" width="105">
<div align="center"><%=rs(i).definedsize%></div>
</td>
 ' 字段长度.

<td class="sundog" height="2" width="69">
<div align="center">
<%
attrib=rs(i).attributes
if (attrib and adfldisnullable)=0 then
response.write "no"
else
response.write "yes"
end if
%>
</div>
</td>

----------------------------------------------------------------------------------------------------------------

 ' 是否允许空值.
<td class="sundog" height="2" width="69">
<div align="center">
<%if rs(i).properties("isautoincrement") = true then%>
<input type="checkbox" name="autoincrement" value="checkbox" checked>
<%else%>
<input type="checkbox" name="autoincrement" value="checkbox">
<%end if%>
</div>
</td>
----------------------------------------------------------------------------------------------------------------

 ' 是否为自动编号.
<td class="sundog" height="2" width="81">
<div align="center">
<%if rs(i).name=primarykey then%>
<input type="checkbox" name="primarykey" value="checkbox" checked>
<%else%>
<input type="checkbox" name="primarykey" value="checkbox">
<%end if%>
</div>
</td>
----------------------------------------------------------------------------------------------------------------

 ' 主健.
</tr>
<%next %>
</table>
</center>

[1]

(0)

相关文章:

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论

验证码:
Copyright © 2017-2025  代码网 保留所有权利. 粤ICP备2024248653号
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com