-1

In the Data Flow Task, I need re-direct each row to exe and get the output for each row, similar to script component.

I tried to use Process in Script Component, but it is throwing exception "StandardOut has not been redirected or the process hasn't started yet.". The code used in Script Component is:

 Process myApp = new Process();
 myApp.StartInfo.FileName = @"Someexe.exe";
 myApp.StartInfo.Arguments = "param1";
 myApp.StartInfo.UseShellExecute = false;
 myApp.StartInfo.RedirectStandardOutput = false;

 myApp.Start();
 while (!myApp.HasExited)
 {
  string result= myApp.StandardOutput.ReadToEnd();
  }

Any suggestions? I would like to know if there is any better way to do this?

prashanth
  • 1
  • 5

1 Answers1

0

Your error message is helpful: "StandardOut has not been redirected..."   Since you want to capture the output, redirecting it to the Destination Component, don't you want to change the line:

myApp.StartInfo.RedirectStandardOutput = false;

to be:

myApp.StartInfo.RedirectStandardOutput = true;


Consider the example at this link, on BOL:
ProcessStartInfo.RedirectStandardOutput Property

Doug_Ivison
  • 778
  • 7
  • 17