Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/310.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 将Excel工作表导入SQL Server时,获取链接服务器的错误“OLE DB提供程序”Microsoft.ACE.OLEDB.12.0”(null)_C#_Wpf_Excel_Sql Server 2008_Excel 2010 - Fatal编程技术网

C# 将Excel工作表导入SQL Server时,获取链接服务器的错误“OLE DB提供程序”Microsoft.ACE.OLEDB.12.0”(null)

C# 将Excel工作表导入SQL Server时,获取链接服务器的错误“OLE DB提供程序”Microsoft.ACE.OLEDB.12.0”(null),c#,wpf,excel,sql-server-2008,excel-2010,C#,Wpf,Excel,Sql Server 2008,Excel 2010,当我实现这段代码时,得到了这个错误 无法为链接服务器null初始化OLE DB提供程序Microsoft.ACE.OLEDB.12.0的数据源对象。 链接服务器null的OLE DB提供程序Microsoft.ACE.OLEDB.12.0返回消息未指定错误 我做了下面所有的事情 sp_配置“显示高级选项”,1 重新配置 sp_配置“临时分布式查询”,1 重新配置 同时安装2010办公系统驱动程序:数据连接组件 还有同样的问题。由于access diver和SQL server之间的不兼容,我遇到

当我实现这段代码时,得到了这个错误

无法为链接服务器null初始化OLE DB提供程序Microsoft.ACE.OLEDB.12.0的数据源对象。 链接服务器null的OLE DB提供程序Microsoft.ACE.OLEDB.12.0返回消息未指定错误

我做了下面所有的事情

sp_配置“显示高级选项”,1 重新配置 sp_配置“临时分布式查询”,1 重新配置 同时安装2010办公系统驱动程序:数据连接组件


还有同样的问题。

由于access diver和SQL server之间的不兼容,我遇到了同样的问题。我甚至无法更改系统的权限。 以下是对我有效的解决方案:

先决条件:

安装的Office产品是32位版本。 O/S是64位的。 安装的SQL Server是64位版本。 问题:

无法执行以下查询: 挑选* 从OPENROWSET 'Microsoft.ACE.OLEDB.12.0', "excel12.0,;HDR=是;数据库=C:\temp\Book.xlsx', '从[Sheet1$]中选择*

将显示以下错误: 这是因为64位MS Access驱动程序Microsoft.ACE.OLEDB.xx.x无法读取32位Excel文件。 解决方案:

在命令提示符下以被动模式安装32位MS Access drive,如下所示: 访问驱动器路径>访问驱动器名称.exe/passive

安装32位SQL Server EXPRESS edition,因为它是免费的

通过执行以下查询,启用即席分布式查询和动态参数等:

现在尝试在SQL查询中读取Excel文件: 还有一件事。。。。确保您尝试读取的文件未打开。

您是否尝试过此操作:?
   OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" returned message "Could not find installable ISAM.".
    Msg 7303, Level 16, State 1, Line 1
    Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)".
E.g.        C:\Users\user_name\Downloads>AccessDatabaseEngine.exe /passive
EXEC sp_configure 'show advanced options', 1
RECONFIGURE
GO
EXEC sp_configure 'ad hoc distributed queries', 1
RECONFIGURE
GO

USE [master] 
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'AllowInProcess', 1
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'DynamicParameters', 1