|
-
June 29th, 2009, 12:02 PM
#1
Process.Start, write to file
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?
-
June 29th, 2009, 01:20 PM
#2
Re: Process.Start, write to file
Well, it looks like your external app is not exiting. It's hard to help without seeing the code behind that program.
-
June 29th, 2009, 03:29 PM
#3
Re: Process.Start, write to file
Please show what are contained within the db_startsql and info variables.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|