首页 | 心情日记 | 建站心得 | 编程技术 | 大盘分析 | 股市信息 | 学习园地 | 电脑技巧 | 物流外贸 | 另类其它 | 站长推荐 | 给我留言 | 相册

用户登陆
用户:
密码:
 
不保存保存一天
保存一月保存一年

站点日历
73 2024 - 3 48
     12
3456789
10111213141516
17181920212223
24252627282930
31


站点统计

最新评论

日志搜索

 标题   内容


随机访问数据库中某个表的一条记录 用ASP程序实现网站在线人数统计
未知 ASP在线获取ACCESS数据库表名及结构   [ 日期:2010-03-09 21:20:43 ]   [ 来自:艾恩ASP学习BLOG ]

海外邮件中继,海外退信中继,美国高速VPS,不限流量VPN,邮局维护和管理,邮件网关,EMOS邮件中继,POSTFIX邮件中继,Winwebmail邮件中继,Winmail邮件中继,DBMail邮件中继,JDMail邮件中继,Exchange邮件中继,MDaemon邮件中继 淘宝店:http://shantan.taobao.com 云邮科技官网:www.yunrelay.com

【字体设置:
此方法可获得ACCESS数据的表名及其结构,数据类型等... 
程序过滤了几个ACCESS数据库的几个隐藏表(可能是导致ACCESS数据库删除数据还会变大的原因) 

<html> 
<head> 
<title>获取ACCESS数据库表名</title> 
</head> 
<body style="text-align:left;margin-left:50px;font-family:'arial';font-size:12px"> 
<form style="padding:5px;margin:5px;margin-left:0px" name="get" action="" method="post"> 
数据库路径:<input type="text" name="path" value="" size="50" /> 
<input type="hidden" name="ari" value="1" /> 
 <input type="submit" value="查看" /> 
</form> 
<hr> 
<% 
if request.form("ari")="1" and request.form("path")<>"" then 
dim conn,connstr,i,sql,rs 
on error resume next 
Connstr="DRIVER=Microsoft Access Driver (*.mdb);DBQ="+server.mappath(request.form("path")) 
Set Conn=Server.CreateObject("ADODB.Connection")  
conn.Open connstr 
If Err Then 
err.Clear 
Set Conn = Nothing 
Response.Write "数据库连接出错,请检查连接字串。" 
Response.End 
End If 
%> 
<font color=red><%=conn.connectionstring%></font><hr> 
<% 
j=0 
dim tablecount 
tablecount=0 
Set shm = conn.OpenSchema(20) 
shm.MoveFirst 
Do While Not shm.EOF 
  If shm("TABLE_TYPE") = "TABLE" Then 
        If Left(shm("table_name"), 1) <> "~" Then '这里过滤掉隐藏表 
           j=j+1 
           call GetFileds(shm("table_name")) 
        End If 
  End If 
  shm.MoveNext 
Loop 
response.write "共有 "&j&" 个数据表!" 
else 
response.write "<h3>请输入数据库相对路径查看具体内容!</h3>" 
end if 
%> 
</body> 
</html> 
<% 
Function GetFileds(TableName) 
Set rs = server.createobject("adodb.recordset") 
Dim SQL 
SQL = "select * from " & TableName 
rs.Open SQL, conn, 1, 1 
Dim Cont 
Cont = rs.Fields.Count 
response.write "<div style=""margin-bottom:10px;padding:5px;border:1px #dddddd solid;background:#eeeeee"">"&vbcrlf 
response.write "表 <font color=red><b>"&TableName&"</b></font> 中含有"&Cont&"个字段,具体如下:<br>"&vbcrlf 
For i = 0 To Cont - 1 
  dim filtype 
  select case rs.fields(i).type 
   case 3  
    filtype="自动编号(数字)" 
   case 202  
    filtype="字符" 
   case 203  
    filtype="备注" 
   case 125 
    filtype="日期" 
   case 11 
    filtype="真/假(是/否)" 
  end select 
  response.write "  <font color=red>"&i&"</font>--<font color=green><b>"&rs.fields(i).name&"</b></font>--"&filtype&";<br />"&vbcrlf 
Next 
response.write "</div>"&vbcrlf 
rs.Close 
set rs=nothing 
End Function 
%> 


暂时没有评论
   发表评论 - 不要忘了输入验证码哦!
作者: 用户:  密码:  我要注册 验证码: 
为防止广告注册机程序,验证码不会自动显示,请点击此处显示或者(刷新)验证码!
评论:

禁止表情
禁止UBB
禁止图片
识别链接
识别关键字
确定发布?
最多可以输入200个字,目前你已经输入了0个字;你今日还可以发表10条评论!
 
   

CopyRight © 2008-2010 广东金融学院030904班 All Rights Reserved
Powered by www.030904.com