Wu.Country@侠缘

勤学似春起之苗,不见其增,日有所长; 辍学如磨刀之石,不见其损,日所有亏!

导航

[导入]ASP访问Access数据表的一些属性

  每次设计的时候都要看数据库表,特别是做一些临时业务的时候。郁闷,写了个程序,简单明了的访问表的一些属性,再打印出来,还不错!

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="db_conn.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<style type="text/css">
<!--
td {
 font-size: 10pt;
 border: 1px solid #000000;
}
-->
</style>
</head>
<%
 set rs=Server.CreateObject("ADODB.Recordset")
 sql="select top 1 * from t_host"
 rs.open sql,conn,1,1
' if rs.eof then
'  response.Write("数据库为空")
'  Response.End()
' end if
%>
<body>
<table width="500" border="0" cellpadding="4" cellspacing="0" bordercolor="#009999" bgcolor="#999999">
  <tr bgcolor="#FFFFFF">
    <td colspan="4">t_host</td>
  </tr>
  <tr align="center" bgcolor="eeeeee">
    <td width="127">字段名</td>
    <td width="102">数据类型</td>
    <td width="51">长度</td>
    <td width="188">说明</td>
  </tr>
  <%
 for each ss in rs.fields
  Response.Write("<tr  bgcolor='#ffffff'>")
  Response.write("<td>"&ss.name&"</td>")
  Response.write("<td>"&ss.Type&"</td>")
  Response.write("<td>"&ss.DefinedSize &"</td>")
  Response.write("<td> </td>")
  Response.Write("</tr>")
 next 
   %>
</table>

</body>
<%
 CloseConn
%>
</html>


文章来源:http://computer.mblogger.cn/wucountry/posts/26079.aspx

posted on 2005-01-22 00:15  Wu.Country@侠缘  阅读(208)  评论(0编辑  收藏  举报