Ad hoc access to OLE DB provider 'Microsoft.Jet.OLEDB.4.0' has been denied. You must access this provider through a link

用sa执行OpenDataSource语句正常,但是用Network Service执行就报这个错误. 说明是权限问题.把sysadmin的Server Roles赋给此用户,也可以正确执行.但是安全性太恐怖. google了一哈,基本都是引自

http://social.msdn.microsoft.com/Forums/en/sqldatabaseengine/thread/0cec4ce4-d210-4973-a888-b7810394f261

但是注册表项 <HKLM>\Software\Microsoft\Microsoft SQL Server\Providers\Microsoft.Jet.OLEDB.4.0却没有找到.

其实是在<HKLM>\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\Providers\Microsoft.Jet.OLEDB.4.0下面. 

 创建一个 DWORD 名为DisallowAdhocAccess 值是 0 的项.就可以了.

 如果在企业管理器中(如下图)勾上Disallow adhoc access ,那么DisallowAdhocAccess的值 也会改成1,但是钩掉的话,此项就不见了....

小Bug. Ad hoc access to OLE DB provider 'Microsoft.Jet.OLEDB.4.0' has been denied. You must access this provider through a link_第1张图片 


 

你可能感兴趣的:(Microsoft)