我被困在這個簡單的事情上。我已經閱讀了大量文章,以獲取SSMS插件的當前連接信息。他們一開始都是用這樣的:無法從ServiceCache.ScriptFactory屬性中檢索IScriptFactory對象
IScriptFactory scriptFactory = ServiceCache.ScriptFactory;
的問題是,我得到一個的NullReferenceException,當我訪問此屬性:
at Microsoft.SqlServer.Management.UI.VSIntegration.ServiceCache.get_ScriptFactory()
我不能爲我的生命找出原因。我使用SSMS 2012,這裏是相關信息:
+-----------------------------------------+------------------+
| Microsoft SQL Server Management Studio | 11.0.2100.60 |
| Microsoft Data Access Components (MDAC) | 6.1.7601.17514 |
| Microsoft MSXML | 3.0 4.0 5.0 6.0 |
| Microsoft Internet Explorer | 9.11.9600.17239 |
| Microsoft .NET Framework | 4.0.30319.18063 |
| Operating System | 6.1.7601 |
+-----------------------------------------+------------------+
項目引用:
C:\ Program Files文件(x86)的\ Microsoft SQL Server的\ 110 \ SDK \組件\微軟。 SqlServer.RegSvrEnum.dll(版本:11.0.0.0)
C:\ Program Files(x86)\ Microsoft SQL Server \ 110 \ Tools \ Binn \ ManagementStudio \ SqlWorkbench.Interfaces.dll(版本:11.0.0.0)
那麼SQL Server 2008呢? 我在SqlServer 2008中找不到這個程序集。 – 2017-08-01 07:19:45