SSIS脚本组件在行上使用foreach循环时出错

时间:2013-12-05 20:00:25

标签: c# ssis

我有以下脚本组件,它使特定列Title Case中的所有数据。 除此之外,我想通过将它们转换为大写来格式化某些地址后缀。我添加foreach循环时出现以下错误:

  

错误:0xC0202009在数据流任务,SQL Server目标[302]:   SSIS错误代码DTS_E_OLEDBERROR。发生OLE DB错误。错误代码:0x80040E14。   OLE DB记录可用。来源:“Microsoft SQL Server Native Client 11.0”Hresult:0x80040E14说明:“无法从OLE DB提供程序”BULK“获取链接服务器”(null)“。*

我已减少目标任务流的超时设置并减少MaxCommitSize但似乎没有任何效果。当我删除循环时,该过程可以正常工作。

代码:

public static string StringInput(string input)
{
    TextInfo tCase = new CultureInfo("en-US", false).TextInfo;
    return tCase.ToTitleCase(Regex.Replace(input.ToLower(), @"\s+", " "));
}

public static List<string> AddressSuffix = new List<string>();

public override void Input0_ProcessInputRow(Input0Buffer Row)
{

    AddressSuffix.Add("Sw");
    AddressSuffix.Add("Nw");
    AddressSuffix.Add("Ne");
    AddressSuffix.Add("Se");

    if (!Row.STREET1_IsNull)
    {
        foreach (string suffix in AddressSuffix)
        {
            if (StringInput(Row.STREET1) == suffix)
            {
                Row.STREET1 = StringInput(Row.STREET1).ToUpper();
            }
            else
            {
                Row.STREET1 = StringInput(Row.STREET1);
            }
        }

    }

0 个答案:

没有答案