1. 程式人生 > 其它 >用Microsoft.Jet.OLEDB.4.0來連線excel檔案資料庫各種錯的解決

用Microsoft.Jet.OLEDB.4.0來連線excel檔案資料庫各種錯的解決

1、

'SQL Server 阻止了對元件 'Ad Hoc Distributed Queries' 的 STATEMENT 'OpenRowset/OpenDatasource' 的訪問,因為此元件已作為此伺服器安全配置的一部分而被關閉。

系統管理員可以通過使用 sp_configure 啟用 'Ad Hoc Distributed Queries'。有關啟用 'Ad Hoc Distributed Queries' 的詳細資訊,請參閱 SQL Server 聯機叢書中的 "外圍應用配置器"。'.

解決:

1.開啟Ad Hoc Distributed Queries元件,在sql查詢編輯器中執行如下語句:

exec sp_configure 
'show advanced options',1 reconfigure exec sp_configure 'Ad Hoc Distributed Queries',1 reconfigure 2.關閉Ad Hoc Distributed Queries元件,在sql查詢編輯器中執行如下語句: exec sp_configure 'Ad Hoc Distributed Queries',0 reconfigure exec sp_configure 'show advanced options',0 reconfigure

2、

'連結伺服器"(null)"的 OLE DB 訪問介面 "Microsoft.Jet.OLEDB.4.0" 返回了訊息 "未指定的錯誤"。'.

再次執行,就可以了。

參考:

https://www.cnblogs.com/BigBigLiang/p/4482255.html

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

道法自然