asp 获取access系统表,查询等操作代码
网络编程 2021-07-05 10:58www.168986.cn编程入门
方法一直接用ado的OpenSchema()方法打开adSchemaTables,建立一个schema记录集
Code:
<%
Const adSchemaTables = 20
adSchemaColumns = 4
dim Conn,db
dim ConnStr
db="temp.mdb" 'ACCESS数据库的文件名,请使用相对于网站根目录的的绝对路径
ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open connstr
Dim rstSchema
Dim I
Set rstSchema = Conn.OpenSchema(adSchemaTables)
Do while not rstSchema.EOF
response.write("Table name: "& rstSchema("TABLE_NAME") & vbCr & _
"Table type: " & rstSchema("TABLE_TYPE") & vbCr)
response.write("<br/>")
I = I + 1
rstSchema.MoveNext
Loop
rstSchema.Close
conn.Close
%>
方法二Aess 系统表 MsysObjects 包含了数据库对象列表。尽管未在文档中记载,你仍可通过查询它来获取你想要的。默认情况下无法操作系统表,必须手动设定权限收才能查询系统表。
请参考以下动画如何获取对msysobject的操作权限 http://blog.iyi./user/david/archives/IMAGES/msobject.swf
我在aess2003中找不到这几个系统表,不知道是不是m$增强了aess的安全性。
使用下列 SQL 语句来获取你想要的
Code:
查询:
SELECT MSysObjects.Name FROM MsysObjects WHERE (Left([Name],1)<>"~") AND (MSysObjects.Type)=5 ORDER BY MSysObjects.Name;
窗体:
SELECT MSysObjects.Name FROM MsysObjects WHERE (Left([Name],1)<>"~") AND (MSysObjects.Type)=-32768 ORDER BY MSysObjects.Name;
表:
SELECT MSysObjects.Name FROM MsysObjects WHERE (Left([Name],1)<>"~") AND (Left$([Name],4) <> "Msys") AND (MSysObjects.Type)=1 ORDER BY MSysObjects.Name;
报表:
SELECT MSysObjects.Name FROM MsysObjects WHERE (Left([Name],1)<>"~") AND (MSysObjects.Type)= -32764 ORDER BY MSysObjects.Name;
模块:
SELECT MSysObjects.Name FROM MsysObjects WHERE (Left([Name],1)<>"~") AND (MSysObjects.Type)= -32761 ORDER BY MSysObjects.Name;
宏:
SELECT MSysObjects.Name FROM MsysObjects WHERE (Left([Name],1)<>"~") AND (MSysObjects.Type)= -32766 ORDER BY MSysObjects.Name;
Code:
<%
Const adSchemaTables = 20
adSchemaColumns = 4
dim Conn,db
dim ConnStr
db="temp.mdb" 'ACCESS数据库的文件名,请使用相对于网站根目录的的绝对路径
ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open connstr
Dim rstSchema
Dim I
Set rstSchema = Conn.OpenSchema(adSchemaTables)
Do while not rstSchema.EOF
response.write("Table name: "& rstSchema("TABLE_NAME") & vbCr & _
"Table type: " & rstSchema("TABLE_TYPE") & vbCr)
response.write("<br/>")
I = I + 1
rstSchema.MoveNext
Loop
rstSchema.Close
conn.Close
%>
方法二Aess 系统表 MsysObjects 包含了数据库对象列表。尽管未在文档中记载,你仍可通过查询它来获取你想要的。默认情况下无法操作系统表,必须手动设定权限收才能查询系统表。
请参考以下动画如何获取对msysobject的操作权限 http://blog.iyi./user/david/archives/IMAGES/msobject.swf
我在aess2003中找不到这几个系统表,不知道是不是m$增强了aess的安全性。
使用下列 SQL 语句来获取你想要的
Code:
查询:
SELECT MSysObjects.Name FROM MsysObjects WHERE (Left([Name],1)<>"~") AND (MSysObjects.Type)=5 ORDER BY MSysObjects.Name;
窗体:
SELECT MSysObjects.Name FROM MsysObjects WHERE (Left([Name],1)<>"~") AND (MSysObjects.Type)=-32768 ORDER BY MSysObjects.Name;
表:
SELECT MSysObjects.Name FROM MsysObjects WHERE (Left([Name],1)<>"~") AND (Left$([Name],4) <> "Msys") AND (MSysObjects.Type)=1 ORDER BY MSysObjects.Name;
报表:
SELECT MSysObjects.Name FROM MsysObjects WHERE (Left([Name],1)<>"~") AND (MSysObjects.Type)= -32764 ORDER BY MSysObjects.Name;
模块:
SELECT MSysObjects.Name FROM MsysObjects WHERE (Left([Name],1)<>"~") AND (MSysObjects.Type)= -32761 ORDER BY MSysObjects.Name;
宏:
SELECT MSysObjects.Name FROM MsysObjects WHERE (Left([Name],1)<>"~") AND (MSysObjects.Type)= -32766 ORDER BY MSysObjects.Name;
上一篇:asp之字符串函数示例
下一篇:kesion科讯V4.0管理员Key工具
编程语言
- 如何快速学会编程 如何快速学会ug编程
- 免费学编程的app 推荐12个免费学编程的好网站
- 电脑怎么编程:电脑怎么编程网咯游戏菜单图标
- 如何写代码新手教学 如何写代码新手教学手机
- 基础编程入门教程视频 基础编程入门教程视频华
- 编程演示:编程演示浦丰投针过程
- 乐高编程加盟 乐高积木编程加盟
- 跟我学plc编程 plc编程自学入门视频教程
- ug编程成航林总 ug编程实战视频
- 孩子学编程的好处和坏处
- 初学者学编程该从哪里开始 新手学编程从哪里入
- 慢走丝编程 慢走丝编程难学吗
- 国内十强少儿编程机构 中国少儿编程机构十强有
- 成人计算机速成培训班 成人计算机速成培训班办
- 孩子学编程网上课程哪家好 儿童学编程比较好的
- 代码编程教学入门软件 代码编程教程