clb2196
June 29th, 2009, 12:02 PM
Author: Carissa
I am trying to use Process.Start to run a command that opens SQLPlus, runs a query, and puts the output in a file. (There are reasons I can't use a batch file).
Right now it works, except the results are written in the new command window it opens to run sqlplus. So I've been trying to write the results to a file, or for now at least to the console.
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = db_startsql;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.Arguments = info;
p.Start();
Console.WriteLine("done with start");
p.WaitForExit();
Console.WriteLine("Done waiting for exit");
string output = p.StandardOutput.ReadToEnd();
Console.Write(output);
It gets to "done with start", and then hangs.
If I output db_startsql+info, and put that in a command line it works, so that's not the problem. Help?
I am trying to use Process.Start to run a command that opens SQLPlus, runs a query, and puts the output in a file. (There are reasons I can't use a batch file).
Right now it works, except the results are written in the new command window it opens to run sqlplus. So I've been trying to write the results to a file, or for now at least to the console.
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = db_startsql;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.Arguments = info;
p.Start();
Console.WriteLine("done with start");
p.WaitForExit();
Console.WriteLine("Done waiting for exit");
string output = p.StandardOutput.ReadToEnd();
Console.Write(output);
It gets to "done with start", and then hangs.
If I output db_startsql+info, and put that in a command line it works, so that's not the problem. Help?