EXEC sp_configure 'show advanced options',1
reconfigure
EXEC sp_configure 'Ad Hoc Distributed Queries',1
reconfigureSELECT CustomerID, CompanyName 
FROM 
OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'D:\Program Files\Microsoft Office\Office12\SAMPLES\Northwind.mdb'; 'admin'; '', Customers)EXEC sp_configure 'show advanced options',0
reconfigure
EXEC sp_configure 'Ad Hoc Distributed Queries',0
reconfigure请问哪里错了?怎么还是提示错误:
消息 15281,级别 16,状态 1,第 6 行
SQL Server 阻止了对组件 'Ad Hoc Distributed Queries' 的 STATEMENT'OpenRowset/OpenDatasource' 的访问,因为此组件已作为此服务器安全配置的一部分而被关闭。系统管理员可以通过使用 sp_configure 启用 'Ad Hoc Distributed Queries'。有关启用 'Ad Hoc Distributed Queries' 的详细信息,请参阅 SQL Server 联机丛书中的 "外围应用配置器"。 

解决方案 »

  1.   

    EXEC sp_configure 'show advanced options',1
    GO
    reconfigure
    GO
    EXEC sp_configure 'Ad Hoc Distributed Queries',1
    GO
    reconfigure
    GO这样试试
      

  2.   

    打开
    SQL2005-配置工具-外围应用配置器-功能的外围应用配置-即席远程查询,将复选框选中,
      

  3.   


    --显示高级选项:
    sp_configure 'show advanced options',1
    RECONFIGURE WITH override
    go
    sp_configure 'Ad Hoc Distributed Queries',1
    RECONFIGURE WITH override
    go