如何显示数据库的结构?
<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")
' 获得表名.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
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]
上一篇:统计在线人数是实时的吗?
栏 目:编程问答
本文标题:如何显示数据库的结构?
本文地址:https://www.xiuzhanwang.com/a1/bianchengwenda/12070.html
您可能感兴趣的文章
- 01-11如何实现点击数的计算?
- 01-11如何判断电子邮件的地址格式是否正确?
- 01-11如何做一个文本搜索?
- 01-11如何实现网上考试?
- 01-11如何实现全文检索?
- 01-11如何用POP3接收电子邮件?
- 01-11如何使用表单发送电子邮件?
- 01-11如何在线更改密码?
- 01-11如何取回已忘记的密码?
- 01-11如何做一个随机密码产生器?
阅读排行
本栏相关
- 01-11如何实现点击数的计算?
- 01-11如何做一个文本搜索?
- 01-11如何判断电子邮件的地址格式是否正
- 01-11如何实现全文检索?
- 01-11如何实现网上考试?
- 01-11如何使用表单发送电子邮件?
- 01-11如何用POP3接收电子邮件?
- 01-11如何取回已忘记的密码?
- 01-11如何在线更改密码?
- 01-11如何做一个随机密码产生器?
随机阅读
- 01-10SublimeText编译C开发环境设置
- 08-05DEDE织梦data目录下的sessions文件夹有什
- 08-05dedecms(织梦)副栏目数量限制代码修改
- 01-10delphi制作wav文件的方法
- 04-02jquery与jsp,用jquery
- 01-11ajax实现页面的局部加载
- 01-10C#中split用法实例总结
- 01-11Mac OSX 打开原生自带读写NTFS功能(图文
- 08-05织梦dedecms什么时候用栏目交叉功能?
- 01-10使用C语言求解扑克牌的顺子及n个骰子