Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 3.0 SSIS脚本组件代码Sql Server 2008存在一些问题_C# 3.0_Ssis - Fatal编程技术网

C# 3.0 SSIS脚本组件代码Sql Server 2008存在一些问题

C# 3.0 SSIS脚本组件代码Sql Server 2008存在一些问题,c#-3.0,ssis,C# 3.0,Ssis,我有一个平面文件,其结构如下 Id Value 1 1,2,3 2 4,5 需要将输出设置为 ID Value 1 1 1 2 1 3 2 4 2 5 我有一个平面文件源和一个脚本组件,它是异步的。在脚本编辑器中,我编写了以下代码 public override void Input0_ProcessInputRow(Input0Buffer Row) { MyOutputBuffer.AddRow();

我有一个平面文件,其结构如下

Id  Value
1   1,2,3
2   4,5
需要将输出设置为

ID  Value
1   1
1   2
1   3
2   4
2   5
我有一个平面文件源和一个脚本组件,它是异步的。在脚本编辑器中,我编写了以下代码

 public override void Input0_ProcessInputRow(Input0Buffer Row)
        {
              MyOutputBuffer.AddRow(); 
               string[] arr = Row.Column1.Split(',');
              foreach (string s in arr)
              {
                if (!string.IsNullOrEmpty(Row.Column0))
                {
                      MyOutputBuffer.ID = Row.Column0;
                      MyOutputBuffer.Values = s;
                      MyOutputBuffer.AddRow();
                }
              }        
        }
        public override void Input0_ProcessInput(Input0Buffer Buffer)
        {
            while (Buffer.NextRow())
            {
                Input0_ProcessInputRow(Buffer);
            }

            if (Buffer.EndOfRowset())
            {
                MyOutputBuffer.SetEndOfRowset();
            }
        }
但是我得到了下面的输出

Id  Value
NULL    NULL
1   1
1   2
1   3
NULL    NULL
2   4
2   5
NULL    NULL
程序中有什么错误

请帮助

获得修复

public override void Input0_ProcessInputRow(Input0Buffer Row)
    {     

        string[] arr = Row.Column1.Split(',');
        foreach (string s in arr)
        {
            MyOutputBuffer.AddRow();
            if (!string.IsNullOrEmpty(Row.Column0))
            {
                MyOutputBuffer.ID = Row.Column0;
                MyOutputBuffer.Values = s;

            }
        }
    }

您可能希望继续并将其标记为答案,以便人们不必打开即可知道答案。:-)