Hello all,
I am working on a VB.NET 2003 windows application in which I am using Diagnostics.Process.Start(...) to launch .sql editors. From afar, this seems like a fairly easy task, however, there are some small nuances that are making this a pain.
First off, users have a choice between multiple .sql editors (notepad, SQL 2000 Query Analyzer, SQL 2005 Management Studio and SQL 2008 Management Studio). Notepad and the SQL 2000 editor are both single instance applications, i.e. when multiple .sql files are opened, each file is opened in a new instance of the application. However, SQL 2005 and SQL 2008 take a tabbed approach, so you can have multiple .sql files opened within a single instance of the application.
Here is what I have:
If you do a Process.Start("<path of sql 2005 management studio", "c:\myfile.sql") it will open the .sql file in a new instance of management studio. If I were to run this multiple times, I would be opening multiple instances of management studio. However, each time I open a new .sql file, I'd like it to go into a new tab. I can achieve this by doing a Process.Start("c:\myfile.sql") and omitting the editor .exe. However, this will only work for the default .sql editor, which, in this case happens to be SQL 2005 Management Studio.
All that said, does anyone have any know of a way to possibly change the default editor for a file with a specific extension for the duration of my application run?
Example timeline:
Given: User X's default .sql editor is SQL 2005 Management Studio
1. User opens my application
2. User changes .sql editor (within my app) to SQL 2008 Management Studio (MS)
3. My app temporarily changes user X's default .sql editor to SQL 2008 MS. (This will enable Process.Start("myfile.sql") to open new tabs within same instance of 2008 MS.
4. User closes my application and their machine's original default .sql editor preference is restored.
Please let me know if any further clarification would be helpful.
Thanks in advance!
I am working on a VB.NET 2003 windows application in which I am using Diagnostics.Process.Start(...) to launch .sql editors. From afar, this seems like a fairly easy task, however, there are some small nuances that are making this a pain.
First off, users have a choice between multiple .sql editors (notepad, SQL 2000 Query Analyzer, SQL 2005 Management Studio and SQL 2008 Management Studio). Notepad and the SQL 2000 editor are both single instance applications, i.e. when multiple .sql files are opened, each file is opened in a new instance of the application. However, SQL 2005 and SQL 2008 take a tabbed approach, so you can have multiple .sql files opened within a single instance of the application.
Here is what I have:
If you do a Process.Start("<path of sql 2005 management studio", "c:\myfile.sql") it will open the .sql file in a new instance of management studio. If I were to run this multiple times, I would be opening multiple instances of management studio. However, each time I open a new .sql file, I'd like it to go into a new tab. I can achieve this by doing a Process.Start("c:\myfile.sql") and omitting the editor .exe. However, this will only work for the default .sql editor, which, in this case happens to be SQL 2005 Management Studio.
All that said, does anyone have any know of a way to possibly change the default editor for a file with a specific extension for the duration of my application run?
Example timeline:
Given: User X's default .sql editor is SQL 2005 Management Studio
1. User opens my application
2. User changes .sql editor (within my app) to SQL 2008 Management Studio (MS)
3. My app temporarily changes user X's default .sql editor to SQL 2008 MS. (This will enable Process.Start("myfile.sql") to open new tabs within same instance of 2008 MS.
4. User closes my application and their machine's original default .sql editor preference is restored.
Please let me know if any further clarification would be helpful.
Thanks in advance!