开发者

automatic execution of sqlplus scrpts, use set lines, spool commands to create an out put file with the required layout using c#

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}");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜