How to send parameter to another program?
-
Hi, hope every one is doing fine. i am developing application in C# 2005, my requirement is to call the exe of SQL Server 2000 Query Analyzer using code, which i did by using: Process.Start("C:\\Program Files\\Microsoft SQL Server\\80\\Tools\\Binn\\isqlw.exe"); it is working fine, now i want that when user opens the SQL Server query analyzer it automatically open a specific database. is it possible? can i send database name as parameter? or there is any other way to do it? Any kind of help is appreciated, thanks in advance Regards, Affan Ahmad Toor .................. QUAIDIAN FOR ONCE, QUAIDIAN FOR EVER!
-
Hi, hope every one is doing fine. i am developing application in C# 2005, my requirement is to call the exe of SQL Server 2000 Query Analyzer using code, which i did by using: Process.Start("C:\\Program Files\\Microsoft SQL Server\\80\\Tools\\Binn\\isqlw.exe"); it is working fine, now i want that when user opens the SQL Server query analyzer it automatically open a specific database. is it possible? can i send database name as parameter? or there is any other way to do it? Any kind of help is appreciated, thanks in advance Regards, Affan Ahmad Toor .................. QUAIDIAN FOR ONCE, QUAIDIAN FOR EVER!
Well, you can pass parameters like this:
Process.Start("Application Path", "Parameters");
... i think. If it actually takes a parameter, i don't know. Just pass the path to the file, and see if it works.My current favourite word is: Nipple!
-SK Genius
-
Hi, hope every one is doing fine. i am developing application in C# 2005, my requirement is to call the exe of SQL Server 2000 Query Analyzer using code, which i did by using: Process.Start("C:\\Program Files\\Microsoft SQL Server\\80\\Tools\\Binn\\isqlw.exe"); it is working fine, now i want that when user opens the SQL Server query analyzer it automatically open a specific database. is it possible? can i send database name as parameter? or there is any other way to do it? Any kind of help is appreciated, thanks in advance Regards, Affan Ahmad Toor .................. QUAIDIAN FOR ONCE, QUAIDIAN FOR EVER!
If the process you are starting supports command-line parameters, then you can send them by using on of the overload of
Process.Start
method#region signature my articles #endregion
-
Hi, hope every one is doing fine. i am developing application in C# 2005, my requirement is to call the exe of SQL Server 2000 Query Analyzer using code, which i did by using: Process.Start("C:\\Program Files\\Microsoft SQL Server\\80\\Tools\\Binn\\isqlw.exe"); it is working fine, now i want that when user opens the SQL Server query analyzer it automatically open a specific database. is it possible? can i send database name as parameter? or there is any other way to do it? Any kind of help is appreciated, thanks in advance Regards, Affan Ahmad Toor .................. QUAIDIAN FOR ONCE, QUAIDIAN FOR EVER!
You'll have to find out if SQL Server can take a paramater at run-time, and do something with it. I'd assume that it can, but if it doesn't you can't do it, obviously. You'll have to find the paramater switches, such as "netstat -o" or something like that. If you find whether or not they are supported, and find the paramater switch you want to use. Something like this would do what you want:
Process cmdLineProcess = new Process(); cmdLineProcess.StartInfo.FileName = strFile; cmdLineProcess.StartInfo.Arguments = strArgs; cmdLineProcess.StartInfo.UseShellExecute = false; cmdLineProcess.StartInfo.CreateNoWindow = true; cmdLineProcess.StartInfo.RedirectStandardOutput = true; cmdLineProcess.StartInfo.RedirectStandardError = true; cmdLineProcess.Start()
Let us know what you find out, I'd be interested to know if SQL supports that. I'm guessing it does, so good luck. Post a link to what you find! :)
I'm going to become rich when I create a device that allows me to punch people in the face over the internet. "If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
-
You'll have to find out if SQL Server can take a paramater at run-time, and do something with it. I'd assume that it can, but if it doesn't you can't do it, obviously. You'll have to find the paramater switches, such as "netstat -o" or something like that. If you find whether or not they are supported, and find the paramater switch you want to use. Something like this would do what you want:
Process cmdLineProcess = new Process(); cmdLineProcess.StartInfo.FileName = strFile; cmdLineProcess.StartInfo.Arguments = strArgs; cmdLineProcess.StartInfo.UseShellExecute = false; cmdLineProcess.StartInfo.CreateNoWindow = true; cmdLineProcess.StartInfo.RedirectStandardOutput = true; cmdLineProcess.StartInfo.RedirectStandardError = true; cmdLineProcess.Start()
Let us know what you find out, I'd be interested to know if SQL supports that. I'm guessing it does, so good luck. Post a link to what you find! :)
I'm going to become rich when I create a device that allows me to punch people in the face over the internet. "If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
It seems that somebody doesn't like you. You've got a 1 vote fanboy.
Deja View - the feeling that you've seen this post before.
-
It seems that somebody doesn't like you. You've got a 1 vote fanboy.
Deja View - the feeling that you've seen this post before.
:-\ I couldn't possible imagine why anyone wouldn't like me. :laugh: :laugh:
I'm going to become rich when I create a device that allows me to punch people in the face over the internet. "If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
-
It seems that somebody doesn't like you. You've got a 1 vote fanboy.
Deja View - the feeling that you've seen this post before.