I'm looking for a way to use my Dataset variable in Script component of SSIS data flow task, here is what I tried till now
My First Task is Execute SQL task (CData PostgreSQL Task)
This would run a Postgre query and store the result in a variable User::resultSet
which is of the data type DataSet
My Second Task is Data Flow Task
In my second task I wish to use the dataset as my source. I tried to achieve this by using Script Component (Source)
My Script
public override void CreateNewOutputRows()
{
DataTable dt = (DataSet)Variables.resultSet;
// The DataTable is now ready to use! No more recordset quirks.
foreach (DataRow dr in dt.Rows)
{
// Add a new output row for this transformed data.
OrdersBuffer.AddRow();
// Now populate the columns
OrdersBuffer.id = int.Parse(dr["id"].ToString());
OrdersBuffer.created = int.Parse(dr["created"].ToString());
OrdersBuffer.modified = int.Parse(dr["modified"].ToString());
}
}
Issue
In my Script, I cant figure out a way to convert the dataset into a datatable,
I believe the problem line is DataTable dt = (DataSet)Variables.resultSet;
in my script
I also tried DataTable dt = resultSet.Tables[0];
& DataTable dt = resultSet.Table[0];
but all them are throwing syntax error.
Any lead or guidance will be really appreciated.