中国站长下载-为中国站长提供最好最全的建站资源! 首 页发布资源有事留言繁體中文
设为首页
加入收藏
联系我们
 
您当前的位置:中国站长下载 -> 文章中心 -> 网页编程 -> ASP编程 -> 文章内容  虚拟主机 域名注册 退出登录 用户管理
栏目导航
· ASP编程 · .NET编程
· PHP编程 · JSP编程
· CGI 专区
热门文章
· sndvol32 - sndvol3...
· [组图] FLASH:《大话李白》...
· 个人网站到底能赚多...
· [图文] Rundll.exe是病毒吗...
· [组图] Flash:制作MV
· 价值12万元的网站SE...
· 网站创业者,你需要...
· 一个成功的网站设计...
· [图文] FLASH:韩国导航条解...
· 中国网站的赚钱模式...
相关文章
· 关于解决商务平台AS...
· 一个ASP木马程序的源...
· 一个ASP木马程序的源...
· 一个ASP木马程序的源...
· 一个ASP木马程序的源...
· 一个ASP木马程序的源...
· 一个ASP木马程序的源...
· 一个ASP木马程序的源...
怎样把数据库结构显示出来的源代码
作者:不详  来源:不详  发布时间:2006-8-13 0:40:05  发布人:chinazhan

 减小字体 增大字体

     通过以上的代码即可显示表的结构,字段类型,长度,自动编号,主健。如果你仔细研究后就可以发现如何远程改变数据库的结构了,祝你好运!
  
  要查看此演示,需要你建立一个数据源,request("table")改为你的表的名字。
  <html>
  <head>
  <title>main</title>
  <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  </head>
  <body bgcolor="#CCCCCC" text="#000000">
  <h2 align="center"><font face="华文新魏">欢迎查看chenyangasp演示程序</font></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>
  
    做人要厚道,请注明转自chinazhan中国站长(www.ChinaZhan.com)。

 
[] [返回上一页] [打 印] [收 藏]
上一篇文章:bbs的树状结构算法
∷相关文章评论∷    (评论内容只代表网友观点,与本站立场无关!) [更多评论...]
中国站长下载
中国站长下载

本页只接受PR>=4 IT类站点连接,申请连接,谢谢您们的支持!希望我们的下载站能够真正帮到中国的站长们!
关于本站 - 网站帮助 - 广告合作 - 下载声明 - 友情连接 - 网站地图
Copyright © 2005-2006 ChinaZhan.Net. All Rights Reserved .