I'm developing a c# application to automatically e开发者_高级运维xecute sqlplus. I would like to find a way to use the set lines, set pages.. and spool command to create an output file of the proper format and layout. here is a code i used to run sqlplus from cmd using c#
ProcessStartInfo processInfo = new ProcessStartInfo();
processInfo.FileName = "sqlplus.exe";
processInfo.Arguments = "username/password@database @scriptFilePath";
Process process = Process.Start(processInfo);
how can i incorporate and use those commands i mentioned above? Help!
Can't you just set the ProcessStartInfo.RedirectStandardInput property to true
and then write to Process.StandardInput?
How about:
- Bring the window to front
- Send the keys
Like following:
Process sqlplus = Process.Start(processInfo);
sqlplus.WaitForInputIdle();
IntPtr hWindow = sqlplus.MainWindowHandle;
ShowWindow(hWindow, 1 /*toggle*/);
SendKeys.SendWait("SELECT * FROM...");
SendKeys.SendWait("{Enter}");
精彩评论