How to get SQL Command text from Query Document in Visual Studio?


hi all,

i building visual studio add-in , want text of sql command in query document.

for example:

  • a user opens server explorer , connects database
  • he executes 'new query' command
  • a new query document opens (query visualiser or whatever want call it)
  • he selects columns in table visualiser panel , code generated in command text panel

what want able generated text. tried using: 

textselection s=(textselection) dte.activedocument.selection;  textdocument d=(textdocument) dte.activedocument.object ("textdocument");

this not work because in first case selection null , in second 1 object null. part of code works if open document .txt or .sql file. tried find class similar querydocument or query, failed.

do have suggestions? 

thanks in advance!

hi loleeca,

  welcome msdn forum support.

  can refer following blog in order understand related information more clearly.

  coding productivity: macros, shortcuts , snippets 

  sincerely,

  jason wang


jason wang [msft]
msdn community support | feedback us



Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'