【问题标题】:Script component error脚本组件错误
【发布时间】:2013-09-09 03:11:18
【问题描述】:

我将 SSIS 中的数据集(查询)传递给脚本组件。但是,执行时出现错误“脚本组件在用户代码中遇到异常:”。我发现其他有同样错误的帖子,但没有一个适用于我的错误。

public override void Input0_ProcessInputRow(Input0Buffer Row)
{
    string[] addresses = (Row.shcladdress).Split(';');
}

【问题讨论】:

  • 我实际上已经解决了。当 shcladdress 为 null 时,出现错误。

标签: ssis


【解决方案1】:

您正试图在可为空的结构上调用 Split 方法。

我会向饺子下注,Row.shcladdress_IsNull 属性对于失败的行是正确的。试试这个代码

public override void Input0_ProcessInputRow(Input0Buffer Row)
{

    string[] addresses = null;
    if (!Row.shcladdress_IsNull)
    {
        // you will probably want to wrap this in a try/catch block as well
        addresses = (Row.shcladdress).Split(';');
    }
    else
    {
        // logic here for empty addresses
        ;
    }
}

【讨论】:

  • 你是对的 - 请参考我最初的问题。但我仍然会给你积分:)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-09-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-02-08
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多