Hi, According to my previous question, Hi, I try to write something like a SQL Editor or something like this, I try to connect. C # to CMD and execute my order. Now my problem is that I get connected to SQLLL after which I can not get the SQLPLUS command, and the other resources I see do not satisfy me please help me how to do my SQL command after connecting to sqlplus Can I survive my procedure to run? Right now I use this code:
// Create the process process. Diagnostics Process preprocess = new system Diagnostics Process (); // strCommand pProcess.StartInfo.FileName = strCommand is the command path and file name to run; // strCommandParameters are the parameters to pass the program pProcess.StartInfo.Arguments = strCommandParameters; Pprrocess.StartInfo.UseShellExecute = false; // Set the program output set to process the output stream at pProcess.StartInfo.RedirectStandardOutput = true; // Optional pprrocess.StartInfo.WorkingDirectory = strWorkingDirectory; // Start the process process Start (); // Program Output String Strawptut = Receive Process Standard Optical Readout (); // Wait for processing to finish Process. Wait formex ();
I have optimized this, I separate initialize, to run the second object I run for the second time, I still have a problem, I will call for the second call I use:
pprrocess.StartInfo.FileName = strCommand; // strCommandParameters are the parameters to pass the program pProcess.StartInfo.Arguments = strCommandParameters; // Start the process process Start (); // Program Output String Strawptut = Receive Process Standard Optical Readout (); // Wait for processing to finish Process. Wait formex ();
Thank you in advance
Your question is a bit confusing but I Looks like I'm seeing your problem. First you should look to see this blog post. Your code violates one that is not listed there. The process uses its own reuse.
You need to rebuild the code:
class MyProcessStarter {Personal ProcessStartInfo _startInfo = new ProcessStartInfo (); Public MyProcessStarter (string exe, string working) {_startInfo.WorkingDirectory = workingDir; _startInfo.FileName = exe; _startInfo.UseShellExecute = false; _startInfo.RedirectStandardOutput = true; } Public string run (string arguments) {_startInfo.Arguments = arguments; Process P = Process Start (_startInfo); P.Start (); String strOutput = p.StandardOutput.ReadToEnd (); P.WaitForExit (); Return Storm; }}
I have written a more complete and accurate implementation that is said to be used to perform the following tasks:
CSharpTest. Using Net.Processes; Partial classroom program {constant integer key (string [] args) {ProcessRunner runs = new processor ("svn.exe"); Run.OutputReceived + = New ProcessApply EventHandler (RunOperup Reclaimed); Return run. Run ("Update", "C: \\ MyOfix"); } Fixed Zero Run_Output Rexide (Object Sender, ProcessAutputEventErgors Algs) {console.lightline ("{0}: {1}", alg. Error? "Error": "output", RGSData); }}