SSIS 2005: I have a DataFlow task consisting of an IDataReader source getting zero or more rows from an Oracle data source and pushing those rows to a Script Component being used as a destination. My goal is to load these records into a DataSet, so I override the Script Component's PreExecute method to build the DataSet and the child DataTable that will hold the records. Then in the InputRow method I add a row to the DataSet, and in the PostExecute method I load the DataSet into a ReadWriteVariable.
My problem is that if there are zero rows returned from the IDataReader and I launch the package from C# code (using the Dts object model), the DataSet never gets set in the ReadWriteVariable. If I change the query so that rows are always returned to the IDataReader, the DataSet gets loaded into the variable, but if zero rows are returned the variable remains just a simple System.Object.
The frustrating part is that if I add in a few System.Windows.Forms.MessageBox.Show() calls to my PreExecute and PostExecute methods and run the package from VisualStudio, the messages appear. I've even gone so far as to inspect the variable in the script component after I set it to the DataSet and return the count of DataTables in a MessageBox. It works just fine in the designer every time.
Can someone explain why the PostExecute method appears not to be firing when I run the package programatically, whereas when I run it from the designer it works just fine? is this some optimization being done in the DataFlow task? Ideally, I would like to see an empty DataSet put into the variable if there are no records returned.
Thanks in advance.