怎么编程来获取系统表MsysObjects的查询权限?

captain_lww 2006-08-27 01:17:40
Access 系统表 MsysObjects 包含了数据库对象列表。但是默认情况下无法操作系统表,必须手动设定权限收才能查询系统表。我想通过程序或者SQL来获得这个系统表的查询权限而不用手动获取,请问各位高手怎么做呀???急啊!!
我的分不够了,只有20了,不好意思。
...全文
629 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
OracleRoob 2006-08-30
  • 打赏
  • 举报
回复
--ADO连接串(带MDW的连接串):

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Test.MDB;User ID=admin;Password=;Jet OLEDB:Database Password=;Jet OLEDB:System database=D:\Test_Sys.MDW;Persist Security Info=False

其中第一个password为Access的用户admin的密码,第二个为Access数据库的密码

captain_lww 2006-08-30
  • 打赏
  • 举报
回复
还是不行啊,没有权限,算了,找另外的方法代替了,谢谢各位!
OracleRoob 2006-08-29
  • 打赏
  • 举报
回复
Jet OLEDB:Database Password

数据库密码
captain_lww 2006-08-29
  • 打赏
  • 举报
回复
To:wangtiecheng
你的连接串内Jet OLEDB:是干吗的呀?如果按照这个连接的话会出现“找不到可安装的ISAM。”错误,把它去掉后连接正确,但是还是没有读取MsysObjects的权利。
To:gxlishuxin
在“用户与组权限中”查看,发现默认的管理员组没有读取msysobjects的权限,但用户组倒有读取这个表的权限,这是为什么呢?这么在程序中以用户组的身份登陆呢?

using the system.mdw file makes it easier to write programs that leave the database locked after the program exits.
The following modification to the demo seems to overcomes the “Record(s) cannot be read; no read permission on MSysObjects” problem without needing to change the security on the database though Access Menus.
我看上面一段英文,好象修改system.mdw就可以获得读取这个表的权限了,但是我没看懂怎么做,各位高手看懂了吗?谢谢
OracleRoob 2006-08-29
  • 打赏
  • 举报
回复
如果设置了工作组信息文件,只通过SQL语句好像无法实现。

用ADO试试。

用ADO和VBA动态访问。

--ADO连接串:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Test.MDB;User ID=admin;Password=;Jet OLEDB:Database Password=;Persist Security Info=False

其中第一个password为Access的用户admin的密码,第二个为Access数据库的密码

gxlishuxin 2006-08-28
  • 打赏
  • 举报
回复
这个查询权限问题是涉及到工作组信息文件的。一般来说,创建access数据库文件时,如果没有特意的设定,admin用户是具有读取MsysObjects表的权限的,这样就可以应用默认的System.mdw工作组信息文件,以admin身份登陆数据库并读取MsysObjects表。当access数据库应用了特意设定的工作组信息文件时(一般的设定是要将admin用户从管理员组中踢开,并且该数据库的所有者也不会是admin,这样才能进一步保证数据库的安全),可以通过以数据库所有者身份登陆来读取MsysObjects表,也可以通过数据库所有者身份来向其他用户指派权限。
captain_lww 2006-08-28
  • 打赏
  • 举报
回复
改动是指在ACCESS中手动获取MsysObjects表的读取权限。
1. Open Microsoft Access
2. From the Tools menu, select the Options menu option
3. On the View tab, click the System Objects checkbox
4. Click OK to save your changes
5. From the Tools menu, select the Security -> User and Group Permissions menu option
6. Click the Permissions tab
7. Select the Table entry in the Object Type combo box
8. Select the Admin userid in the User/Group Name listbox
9. In the Object Name listbox, select the MSysObjects entry
10. In the Permissions group box, check the Read Data check box
这个好象与使用DAO和ADO访问关系不大啊,我在一个网站上发现下面一段程序但是看不大明白,高手能不能帮分析一下?
using the system.mdw file makes it easier to write programs that leave the database locked after the program exits.
The following modification to the demo seems to overcomes the “Record(s) cannot be read; no read permission on MSysObjects” problem without needing to change the security on the database though Access Menus.
use header #include "AFXDAO.H" to use the DAO functions and classes below
************************************************************************
In CAccessReportViewerDoc.cpp add function
void SetSystemDB( CString & strSystemMDB )
{
COleVariant varSystemDB( strSystemMDB, VT_BSTRT );
// Initialize DAO for MFC
AfxDaoInit( );
DAODBEngine* pDBEngine = AfxDaoGetEngine( );
ASSERT( pDBEngine != NULL );
// Call put_SystemDB method to set the
// system database for DAO engine
DAO_CHECK( pDBEngine->put_SystemDB( varSystemDB.bstrVal ) );
}
and modify function
BOOL CAccessReportViewerDoc::OnOpenDocument(LPCTSTR lpszPathName)
{
//modify this to point to your system.mdw
CString strSystemDB =
_T( "C:\\Documents and Settings\\John\\Application Data\\Microsoft\\Access\\System.mdw" );
static bool bSetSystemDB=false;
if(bSetSystemDB==false)
{
SetSystemDB( strSystemDB );
bSetSystemDB=true;
}
if (!CDocument::OnOpenDocument(lpszPathName))
return FALSE;
m_pAccessReports = new CAccessReports(lpszPathName, TRUE);
return TRUE;
}
*********************************************************************************
In CAccessReportViewerDoc.cpp add and modify function
int CAccessReportViewerApp::ExitInstance()
{
// TODO: Add your specialized code here and/or call the base class
//terminates the DAO database engine
AfxDaoTerm( );
return CWinApp::ExitInstance();
}
他是怎么不通过ACCESS的菜单而自动获取这个表的权限的呢???
OracleRoob 2006-08-28
  • 打赏
  • 举报
回复
--ADO连接串:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Test.MDB;User ID=admin;Password=;Jet OLEDB:Database Password=;Persist Security Info=False

其中第一个password为Access的用户admin的密码,第二个为Access数据库的密码
OracleRoob 2006-08-28
  • 打赏
  • 举报
回复
改动什么?

用ADO访问试试。
captain_lww 2006-08-27
  • 打赏
  • 举报
回复
我只查询就够了,可是好象也没有权限查询。我使用VB.NET,用DAO对ACCESS数据库操作。
每次SELECT * FROM MSysObjects时候都是报错,说没有权限,但是在access中手动改一下就好了,怎么用程序操作呢?
高手帮帮忙呀!
OracleRoob 2006-08-27
  • 打赏
  • 举报
回复
默认情况下无法操作系统表
------------------------------
楼主要修改系统表吗?


默认情况下,可以直接用SQL查询MSysObjects表,如:

SELECT *
FROM MSysObjects;

7,714

社区成员

发帖
与我相关
我的任务
社区描述
Microsoft Office Access是由微软发布的关系数据库管理系统。它结合了 MicrosoftJet Database Engine 和 图形用户界面两项特点。
社区管理员
  • Access
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧