I was attempting to add the SSMS connection dialog to my utility and ran into problems with referenced assemblies.
The ConnectionDialog is documented here: https://msdn.microsoft.com/en-us/library/microsoft.sqlserver.management.ui.connectiondlg.aspx ...
The following is a snippet using the SSMS ConnectionDialog in a C# application.
ConnectionDialog dlg = new Microsoft.SqlServer.Management.UI.ConnectionDlg.ConnectionDialog();Microsoft.SqlServer.Management.UI.ConnectionDlg.
Microsoft.SqlServer.Management.Smo.RegSvrEnum.
UIConnectionInfo connInfo = new Microsoft.SqlServer.Management.Smo.RegSvrEnum.UIConnectionInfo { ApplicationName = "My App" };
IDbConnection conn;
dlg.AddServer(new Microsoft.SqlServer.Management.UI.ConnectionDlg.SqlServerType());
dlg.Text = "Connect to My Database";
DialogResult dr = dlg.ShowDialogValidateConnection(this, ref connInfo, out conn);
To compile the properly, references to the RegSvrEnum and ManagementControls are required. I compiled it on my system and provided it to a peer, who quickly caused the application to fail with missing assembly references.
I built the application using the SQL Server SSMS 2015 July Preview and they had SQL Server 2014 on their system. No problem I made sure both assemblies were in the same directory as my application but this still failed.
Following the trail of missing assemblies I had to provide the following in order for the application to execute.
There is not a redistributable package containing these assemblies. The supported way is to install the matching SSMS package on the target system. SSMS can be installed separately using the following link: https://msdn.microsoft.com/en-us/library/mt238290.aspx?f=255&MSPPError=-2147217396
Bob Dorr - Principal SQL Server Escalation Engineer
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.