<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]
发表评论