Automate db connection for a Visual Studio sql document
<p><a href="https://i.stack.imgur.com/2VhJL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2VhJL.png" alt="enter image description here"></a>
When you edit a sql file in the Transact-SQL Editor in VS, you can push the connect button to bring up a db connection dialogue. How can I automate this from a VS extension? I can catch the fileOpen event no problem. Does anyone know where in DTE the connect command is hiding? Not just popping the dialogue, but a method that takes a connection string and connects the editor window.</p>

<h2>Update</h2>

<p>I've listed all my VS commands. The one corresponding to the connect button is "SQL.TSqlEditorConnect". I don't seem able to call it without getting in an endless loop, and I suspect it's just the command for opening the dialog, not creating the connection.</p>