我一直严重依赖 Windows 的 SSMS 快捷方式,其中包括命令行开关,使我能够快速打开特定服务器上的特定数据库。例如
Ssms.exe -S 123.123.123.123 -U sa -P goodpassword -d DbName
或
Ssms.exe -S . -E -d DbName
这些突然停止工作。我从 SSMS 收到此错误:
Failed to create new SQL Server script.
Object reference not set to an instance of an object. (AppIDPackage)
Program Location: at Microsoft.SqlServer.Management.UI.VSIntegration.
AppIDPackage.AppIDPackage.OpenConnectionDialogWithGlobalConnectionInfo()
我仍然可以在没有命令行开关的情况下启动 SSMS,然后手动建立连接。一些命令行开关仍然有效,例如
ssms.exe -nosplash
工作正常。
使用 -S、-E 和 -d 命令行开关的任意组合都会出现相同的错误。我是否指向有效的服务器或数据库,或者我的登录凭据是否良好并不重要。我可以指出 SSMS 的旧版本,它工作正常,但 2008 版本则不行。
这篇文章MSDN 论坛上的内容是我在网上找到的所有内容,但 MS 在该主题上并没有提供太多帮助。
我有什么想法可以开始解决这个问题吗?我在不同服务器上使用许多不同的数据库,并且我非常依赖这些快捷方式。
I've always relied heavily on Windows shortcuts to SSMS that include command-line switches allowing me to quickly open up a specific database on a specific server. For example
Ssms.exe -S 123.123.123.123 -U sa -P goodpassword -d DbName
or
Ssms.exe -S . -E -d DbName
These suddenly stopped working. I get this error from SSMS:
Failed to create new SQL Server script.
Object reference not set to an instance of an object. (AppIDPackage)
Program Location: at Microsoft.SqlServer.Management.UI.VSIntegration.
AppIDPackage.AppIDPackage.OpenConnectionDialogWithGlobalConnectionInfo()
I can still launch SSMS without the command-line switches, and then manually establish the connections. Some command-line switches still work, for example
ssms.exe -nosplash
works fine.
I get the same error with any combination of the -S, -E, and -d command-line switches. It doesn't matter if I'm pointing to a valid server or database or not, or if my login credentials are good or not. I can point to the older version of SSMS and it works fine, but not the 2008 version.
This post on MSDN's forums is all I've found online, but MS hasn't been very helpful on this thread.
Any ideas how I might start to fix this? I work with a lot of different databases on different servers, and I really rely on these shortcuts.
发布评论
评论(4)
我已经将有问题的 DLL 扔到了 Reflector 上,它在这篇文章的底部给了我代码,遗憾的是,代码中没有任何明显的内容可以让您轻松弄清楚为什么它不再为您工作(不是吗?)如果 Microsoft 随其生成的针对 CLR 编写的任何内容一起提供调试符号,那该多好啊?)。
有几个地方的代码让我想知道您是否可能有损坏的“最近使用的服务器”列表或类似的内容,也许您可以尝试按照 这个问题来清除它们,看看是否有帮助。
I've thrown the DLL in question at reflector and it's given me back the code at the bottom of this post, sadly there's nothing immediately obvious in the code that makes it easy to work out why it's stopped working for you (wouldn't it be nice if Microsoft shipped debug symbols with anything they produce that's written against the CLR?).
There are a couple of places where the code makes me wonder if you might have a corrupted "recently used servers" list or something similar, perhaps you could try following the steps listed in this question to clear them out and see if that helps.
必须打开 ObjectExplorer 窗口。不要隐藏。
我这样解决了我的问题:)
The ObjectExplorer window must be open. Don't hide.
I solved my problem this way :)
像这样工作正常:
Works fine like this:
我正在对 SQL2005 数据库使用 SSMS2008,并且 ssms 命令行在这里工作正常。
这是 SSMS“关于”对话框生成的版本信息:
有多个来源 (MSSqlTips 和 此处)声明命令行参数在
sqlwb.exe
上可用。然而 ssms< 的联机丛书页面/a> 表明这些选项在ssms
上可用。I'm using SSMS2008 against a SQL2005 database, and the ssms command line works fine here.
This is the version info produced by the SSMS About dialog:
There are several sources (MSSqlTips, and here) that state the command line arguments are available on
sqlwb.exe
. Yet the Books Online page for ssms states that the options are available onssms
.