asp源码如何显示数据库字段的结构?
发布时间:2010-06-08 09:35:00
如何显示数据库的结构?
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#CCCCCC" text="#000000">
<h2 align="center">asp教程之查看数据库结构 - www.aspxhome.com</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>


猜你喜欢
- 初衷NumPy、Pandas、Matplotlib、SciPy 等可以说是最最最常用的 Python 库了。我们在使用 Python 库的时
- 英文原文:http://www.usabilitypost.com/2009/04/15/8-characteristics-of-succ
- 本文主要介绍了Jupyter notebook快速入门教程,分享给大家,具体如下:本篇将给大家介绍一款超级好用的工具:Jupyter not
- 根据不同配置文件调用不同的验证函数检查输入。可以根据需求更改验证函数的逻辑。def VerifyData(func):  
- 在默认的情况下,MySQL搜索不区分大小写(但某些字符集始终区分大小写,如czech)。这意味着,如果你使用col_name LIKE
- 以下均在本人虚拟机上进行1.安装pip3sudo apt install python3-pip2.安装虚拟环境sudo apt insta
- 在对模型训练时,为了让模型尽快收敛,一件常做的事情就是对数据进行预处理。这里通过使用sklearn.preprocess模块进行处理。一、标
- 简介pycurl类似于Python的urllib,但是pycurl是对libcurl的封装,速度更快。本文使用的是pycurl 7.43.0
- __author__ = 'clownfish'#coding:utf-8import urllib2,urllib,coo
- 做渗透测试的时候,有个比较大的项目,里面有几百个网站,这样你必须首先确定哪些网站是正常,哪些网站是不正常的。所以自己就编了一个小脚本,为以后
- 1 概述C/C++和Java(以及大多数的主流编程语言)都有自己成熟的单元测试框架,前者如Check,后者如JUnit,但这些编程框架本质上
- 本文实例为大家分享了python实现简单聊天室的具体代码,供大家参考,具体内容如下刚刚接触python编程,又从接触java开始一直对soc
- 下面先说说window.showModalDialog的基本用法showModalDialog() (IE 4+ 支持)showModele
- 这篇文章主要介绍了python Jupyter运行时间实例过程解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价
- 发布Python包上一篇介绍了如何使用别人的轮子,现在我们讨论下如何自己造轮子给别人用。作为一个流行的开源开发项目,Python拥有一个活跃
- 为了更好的进行封装,每个实现不同功能的js代码应该有自己的js文件,这样如果一个网页中引用了多个js文件,如下 <script typ
- 导语哈喽哈喽!大家好!我是木木子,又到了每日游戏更新环节!8月30日,对暑假还意犹未尽的孩子们收到了一份“开学大礼”:通知要求,严格限制向未
- 这里主要是讲在asp下两次由access数据库升级到sql server数据库后的经验及注意事项,其它语言也可以参考一下。欢迎讨论补充。1.
- 用SQLyog来分析MySQL数据库:SOLyog的下载、安装以及使用很简单。我去了相关网站下载,它只有384K字节大小。它把两个文件(一个
- 本系列教程我们将使用python实现一些简单的测试工具,为了尽可能的简单,我们的工具以命令行工具为主。本系列教程使用的python版本是3.