Click here to Skip to main content
14,735,318 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I have the following codes in script component in ssis data flow. "PartNo" will be passed in as:
ABC
DEF
GHI

How can I concatenate them into one string like ABC,DEF,GHI?
After I have written my script as below, it prompts me an error message
Below are my script:

public override void Input0_ProcessInputRow(Input0Buffer Row)
{
    string PartNo = Row.PartNo;
    foreach (string partNumber in Row.PartNo)
    {
        Output0Buffer.AddRow();
        Output0Buffer.PartNoAll = PartNo;
    }
}



If I remove the foreach loop, there is no error but the output is not as I desired.
Any help would be appreciated. Thank you.
Posted

1 solution

The easiest way is like this:

string result = string.Join(",",Row.PartNo)


That is assuming that Row.PartNo is an enumerable
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900