I have two script tasks in my SSIS package. The first one saves a string array as a package variable:
// In 1st script task:
String[] astrCustNames = new String[cust_count];
/* ...
* Some code to add strings to array ...
*/
// Add array to a package variable
Dts.Variables["CustomerNames"].Value = astrCustNames;
The second task should then extract the strings from the variable. In the past, I've done this with a table variable. This won't work for the string array:
// In 2nd script task:
OleDbDataAdapter ole_da = new OleDbDataAdapter();
// Fill the customer names data table
DataTable dtCustNames = new DataTable();
ole_da.Fill(dtCustNames, Dts.Variables["User::CustomerNames"].Value);
The call that fills the data adapter will result in the error "Object is not an ADODB.RecordSet or an ADODB.Record."
The .dtsx package lists the data type as DTS:DataType="13"
The data type of the variable as it is defined in the package is "Object":
// Returns type "Object":
TypeCode cur_type = Dts.Variables["User::CustomerNames"].DataType;
I've been searching for an example of extracting strings stored in an array in an SSIS variable, but have found none.