locked
Connection string for addin in Visual Studio 2012 RRS feed

  • Question

  • Hi there!

    I develop an addin for MSVS 2012. I need to get connection string for tsql tab currently opened.

    I used IScriptFactory interface members to get connection string in MSVS 2010 (I use ServiceCache.ScriptFactory.CurrentlyActiveWndConnectionInfo.UIConnectionInfo property). IScriptFactory interface is defined in Microsoft.SqlServer.SqlTools.VSIntegration.VS.dll assembly.

    For SSMS 2012 I use the same interface but defined in SqlPackageBase.dll assembly.

    I can find neither Microsoft.SqlServer.SqlTools.VSIntegration.VS.dll nor SqlPackageBase.dll assemblies in MSVS 2012 (Ultimate RTM) installed folder.

    Also I tried to find CurrentlyActiveWndConnectionInfo class and IScriptFactory interface in all MSVS 2012 assemblies installed but found nothing.

    How can I get connection string for current tsql tab in MSVS 2012?




    • Edited by Nickolay Laptev Saturday, September 15, 2012 12:10 PM Bolded question
    Saturday, September 15, 2012 12:04 PM

Answers

  • I think what the assemblies you need is in SQLEditors.dll.

    If you are using the sql server 2012, you will found them.

    • Marked as answer by Nickolay Laptev Wednesday, September 26, 2012 9:41 AM
    Tuesday, September 18, 2012 1:59 AM

All replies

  • I think what the assemblies you need is in SQLEditors.dll.

    If you are using the sql server 2012, you will found them.

    • Marked as answer by Nickolay Laptev Wednesday, September 26, 2012 9:41 AM
    Tuesday, September 18, 2012 1:59 AM
  • I tried to get the connection string from VS opened sql editor like Nickolay Laptev. However, if I used 

    Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ScriptFactory.Instance.CurrentlyActiveWndConnectionInfo

    It throws an exception

      Message=Operation is not valid due to the current state of the object.
      Source=SQLEditors
      StackTrace:
           at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ScriptFactory.get_CurrentlyActiveWndConnectionInfo()

    If I used

    Microsoft.SqlServer.Management.UI.VSIntegration.ServiceCache.ScriptFactory.CurrentlyActiveWndConnectionInfo
    

    It's always null.

    I spent lots of time on it, but could not figure out how to get the connection string.

    Any help is appreciated.

    Thank you!


    • Edited by joxyz123 Sunday, November 29, 2015 8:22 PM
    Sunday, November 29, 2015 7:30 PM