如何显示数据库的结构?

2023-12-07 0 411

<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 nexttable=request(\”table\”)\’ 获得表名.

if table<>\”\” thenresponse.write \”数据表:\”&tableSet primary = con.OpenSchema(adSchemaPrimaryKeys, _Array(empty, empty, table))if primary(\”COLUMN_NAME\”)<>\”\” thenprimarykey=primary(\”COLUMN_NAME\”)end ifprimary.closeset 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).typeselect case field_typecase adEmptytyp = \”Empty\”case adTinyInttyp = \”TinyInt\”case adSmallInttyp = \”SmallInt\”case adIntegertyp = \”Integer\”case adBigInttyp = \”BigInt\”case adUnsignedTinyInttyp = \”UnsignedTinyInt\”case adUnsignedSmallInttyp = \”UnsignedSmallInt\”case adUnsignedInttyp = \”UnsignedInt\”case adUnsignedBigInttyp = \”UnsignedBigInt\”case adSingletyp = \”Single\”case adDoubletyp = \”Double\”case adCurrencytyp = \”Currency\”case adDecimaltyp = \”Decimal\”case adNumerictyp = \”Numeric\”case adBooleantyp = \”Boolean\”case adErrortyp = \”Error\”case adUserDefinedtyp = \”UserDefined\”case adVarianttyp = \”Variant\”case adIDispatchtyp = \”IDispatch\”case adIUnknowntyp = \”IUnknown\”case adGUIDtyp = \”GUID\”case adDATEtyp = \”DATE\”case adDBDatetyp = \”DBDate\”case adDBTimetyp = \”DBTime\”case adDBTimeStamptyp = \”DBTimeStamp\”case adBStrtyp = \”BStr\”case adChartyp = \”Char\”case adVarChartyp = \”VarChar\”case adLongVarChartyp = \”LongVarChar\”case adWChartyp = \”WChar\”case adVarWChartyp = \”VarWChar\”case adLongVarWChartyp = \”LongVarWChar\”case adBinarytyp = \”Binary\”case adVarBinarytyp = \”VarBinary\”case adLongVarBinarytyp = \”LongVarBinary\”case adChaptertyp = \”Chapter\”case adPropVarianttyp = \”PropVariant\”case elsetyp = \”Unknown\”—————————————————————————————————————-

end selectresponse.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).attributesif (attrib and adFldIsNullable)=0 thenresponse.write \”No\”elseresponse.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) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

悠久资源 编程10000问 如何显示数据库的结构? https://www.u-9.cn/biancheng/bc10000/126413.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务