来源:http://www.htmer.com/article/922.htm

今天单位一ASP.NET网站,里面有个功能是导出数据,发现一导出就报错,报错内容是:SQL  Server 阻止了对组件 'Ad Hoc Distributed Queries' 的  STATEMENT'OpenRowset/OpenDatasource'  的访问,因为此组件已作为此服务器安全配置的一部分而被关闭。系统管理员可以通过使用 sp_configure 启用 'Ad Hoc  Distributed Queries'。有关启用 'Ad Hoc Distributed Queries' 的详细信息,请参阅 SQL  Server 联机丛书中的 "外围应用配置器"。

看错误提示就知道是因为SQL Server的Ad Hoc Distributed Queries组件被禁用了,这里我用的SQL Server版本是2005,只需要开启Ad Hoc Distributed Queries就可以了,方法如下:

1.开启Ad Hoc Distributed Queries组件,在sql查询编辑器中执行如下语句:

1
2
3
4
exec sp_configure 'show advanced options',1
reconfigure
exec sp_configure 'Ad Hoc Distributed Queries',1
reconfigure

2.关闭Ad Hoc Distributed Queries组件,在sql查询编辑器中执行如下语句:

1
2
3
4
exec sp_configure 'Ad Hoc Distributed Queries',0
reconfigure
exec sp_configure 'show advanced options',0
reconfigure

------------------------------ 前台修改------------------------------

在程序中系统提示:SQL Server 阻止了对组件 ‘ Ad Hoc Distributed Queries ’ 的 STATEMENT  ‘ OpenRowset/OpenDatasource ’ 的访问,因为此组件已作为此服务器安全配置的一部分而被关闭。系统管理员可以通过使用 sp_configure 启用 ‘ Ad Hoc Distributed Queries ’。有关启用 ‘ Ad Hoc Distributed Queries ’ 的详细信息,请参阅SQL Server联机丛书中的 “ 外围应用配置器 ”。

 
问题截图

1、开始 — 所有程序 — Microsoft SQL Server 2008 R2 — SQL Server Management Studio(如图1-1)。

 
图 1-1

2、进入后会弹出窗口【连接到服务器】,在【身份验证】选择中【Windows身份验证】— 点击【连接】(如图1-2)。

 
图 1-2

3、在数据库服务实例名(如图1-3,GP-PC\sql2008位置)点击鼠标右键【方面】。

 
图 1-3

4、在窗口【查看方面】— 点击【常规】— 【方面】— 选择【外围应用配置器】(如图1-4)。

 
图 1-4

5、找到【AdHocRemoteQueriesEnabled】— 选择【True】— 点击【确定】(如图1-5)退出后再登录程序即可。

 

解决SQL Server 阻止了对组件Ad Hoc Distributed Queries访问的方法的更多相关文章

  1. 解决SQL Server 阻止了对组件 'Ad Hoc Distributed Queries' 的 STATEMENT 'OpenRowset/OpenDatasource' 的访问

    根据需要进行asp.net的数据导入导出,结果报以下错: mark-1: [报错]SQL Server 阻止了对组件 'Ad Hoc Distributed Queries' 的 STATEMENT ...

  2. 解决“SQL Server 阻止了对组件 'Ad Hoc Distributed Queries' 的 STATEMENT 'OpenRowset/OpenDatasource' 的访问……”【转】

    SQL Server 阻止了对组件 /'Ad Hoc Distributed Queries/' 的访问 在Sql Server中查询一下Excel文件的时候出现问题: SELECT *  FROM ...

  3. 解决SQL Server 阻止了对组件 'Ad Hoc Distributed Queries' 的 STATEMENT'OpenRowset/OpenDatasource' 的访问的方法

    1.开启Ad Hoc Distributed Queries组件,在sql查询编辑器中执行如下语句: reconfigure reconfigure 2.关闭Ad Hoc Distributed Qu ...

  4. 【转载】解决SQL Server 阻止了对组件 'Ad Hoc Distributed Queries' 的 STATEMENT'OpenRowset/OpenDatasource' 的访问的方法

    1.开启Ad Hoc Distributed Queries组件,在sql查询编辑器中执行如下语句: exec sp_configure 'show advanced options',1 recon ...

  5. SQL Server 阻止了对组件 'Ad Hoc Distributed Queries' 的 STATEMENT 'OpenRowset/OpenDatasource' 的访问

    消息 15281,级别 16,状态 1,第 2 行SQL Server 阻止了对组件 'Ad Hoc Distributed Queries' 的 STATEMENT 'OpenRowset/Open ...

  6. 关于“SQL Server 阻止了对组件 'Ad Hoc Distributed Queries' 的 STATEMENT'OpenRowset/OpenDatasource' 的访问 ”

    原因:在从远程服务器复制数据到本地时出现“SQL Server 阻止了对组件 'Ad Hoc Distributed Queries' 的 STATEMENT'OpenRowset/OpenDatas ...

  7. [sql异常]SQL Server 阻止了对组件 'Ad Hoc Distributed Queries' 的

    //执行远程数据库表查询 SELECT * FROM OPENDATASOURCE('SQLOLEDB', 'Data Source=数据库地址;User ID=sa;password=sa' ).n ...

  8. SQL Server 阻止了对组件 'Ad Hoc Distributed Queries' 的 STATEMENT'OpenRowset/OpenDatasource' 的访问

    delphi ado 跨数据库访问 语句如下 ' and db = '帐套1' 报错内容是:SQL Server 阻止了对组件 'Ad Hoc Distributed Queries' 的 STATE ...

  9. Sql导出数据报错-->SQL Server 阻止了对组件 'Ad Hoc Distributed Queries' 的 STATEMENT'OpenRowset/OpenDatasource' 的访问

    SQL Server 阻止了对组件 'Ad Hoc Distributed Queries' 的 STATEMENT'OpenRowset/OpenDatasource' 的访问,因为此组件已作为此服 ...

随机推荐

  1. AM335X UBOOT(以UART为例分析UBOOT主要流程)

    UBOOT2016.05 UART初始化及设置 SPL阶段 第一部分C函数 |- s_init //(arch/arm/cpu/armv7/am33xx/board.c) |- set_uart_mu ...

  2. 【Maven】Maven之scope依赖范围

    一.理解Maven scope依赖范围的作用 Maven在编译项目主代码的时候需要使用一套classspath.总共有三种classpath,分别对应于Maven编译项目主代码的时候.Maven编译和 ...

  3. springboot 集成J2Cache

    J2Cache 是 OSChina 目前正在使用的两级缓存框架.第一级缓存使用 Ehcache,第二级缓存使用 Redis .由于大量的缓存读取会导致 L2 的网络成为整个系统的瓶颈,因此 L1 的目 ...

  4. rn 环境搭建

    https://reactnative.cn/docs/next/getting-started.html 搭建开发环境 欢迎使用 React Native!这篇文档会帮助你搭建基本的 React N ...

  5. 201671010436 王雪刚 实验十四 团队项目评审&课程学习总结

    一:实验名称:团队项目评审&课程学习总结 二:实验目的与要求 (1)掌握软件项目评审会流程: (2)反思总结课程学习内容. 三:实验步骤 任务一:按照团队项目结对评审名单,由项目组扮演乙方,结 ...

  6. 20180414模拟赛T2——拼图

    拼图 源程序名 puzzling.??? (PAS,BAS,C,CPP) 可执行文件名 puzzling.EXE 输入文件名 puzzling.IN 输出文件名 puzzling.OUT 时间限制 1 ...

  7. mysql关键字--设计表时要避开,否则回报语法错误

    https://dev.mysql.com/doc/refman/5.7/en/keywords.html#keywords-in-current-series Keywords and Reserv ...

  8. Async programming

    Asynchrony, in computer programming, refers to the occurrence of events independent of the mainprogr ...

  9. (知识点4)C++ 中vector

    1.定义vector<vector<int>> M; 2.添加元素这里是vector的嵌套使用,本质是vector元素里的每个元素也是vector类型,所以抓住本质来添加元素就 ...

  10. 判断一个数是否能整开方,perfect square

    int m,n;m=sqrt(n);m*m==n?yes:no; https://www.codewars.com/kata/56269eb78ad2e4ced1000013/solutions/ja ...