一个小站点,用sql server 2005 express(vs2005自带的)做数据库,需要导入execl,使用了OPENROWSET导入,本机原本出现无法导入的现象,后通过google找到答案,执行:sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Ad Hoc Distributed Queries', 1;
GO
RECONFIGURE;
GO就ok了
但我现在在xp上发布,又为xp装上了sql server 2005 express,但在导入时出现如下错误:
SQL Server blocked access to STATEMENT 'OpenRowset/OpenDatasource' of component 'Ad Hoc Distributed Queries' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'Ad Hoc Distributed Queries' by using sp_configure. For more information about enabling 'Ad Hoc Distributed Queries', see "Surface Area Configuration" in SQL Server Books Online.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
执行了原来的命令还是没用!求解!
GO
RECONFIGURE;
GO
sp_configure 'Ad Hoc Distributed Queries', 1;
GO
RECONFIGURE;
GO就ok了
但我现在在xp上发布,又为xp装上了sql server 2005 express,但在导入时出现如下错误:
SQL Server blocked access to STATEMENT 'OpenRowset/OpenDatasource' of component 'Ad Hoc Distributed Queries' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'Ad Hoc Distributed Queries' by using sp_configure. For more information about enabling 'Ad Hoc Distributed Queries', see "Surface Area Configuration" in SQL Server Books Online.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
执行了原来的命令还是没用!求解!
解决方案 »
- [请教]DataGrid编辑时如何时其中某一项TextBox不可更改?
- 一个很严肃的问题,等待专家来回答,没分
- 启动iis的默认web站点,提示"拒绝访问"
- 提取网页中图片地址的正则表达式怎么写?
- 嵌入在一框架内的页面viewstate值怎么会丢失呢?
- 如何在网页中动态的获得.net框架的版本号
- 如何取datatable多列中的2列数据 然后绑定到chartlet图表控件
- 谁有《亲密接触ASP.NET》这本书的的数据库文件,源码我有!
- datagrid增加合计的问题
- 关于数据表格操作列位置
- 搜索数据库的一张视图 当中有的数据为NULL我想用case cm1 when NULL then '123' else cm1 end as name
- 【高分求教】一个和数组相关的问题:怎样把一个数组里每个数字分别存进数据库啊??
似乎也reconfigure了,可还是不行!救命呀!
SqlConnection myconn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
myconn.Open();
string mycom = "insert into student select * from OPENROWSET('MICROSOFT.JET.OLEDB.4.0', 'Excel 5.0;HDR=YES;DATABASE=" + source + "',sheet1$)";
SqlCommand mycommm = new SqlCommand(mycom, myconn);
mycommm.ExecuteNonQuery();
myconn.Close();
<connectionStrings>
<add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
2. 打开ad hoc高级选项sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Ad Hoc Distributed Queries',1
GO
RECONFIGURE;
GO
可惜还是不行