在自定义 SSIS 组件中找不到 SetDataTypeProperties 方法 [英] Method not found SetDataTypeProperties in custom SSIS component

查看:19
本文介绍了在自定义 SSIS 组件中找不到 SetDataTypeProperties 方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建一个简单的自定义 SSIS 组件,该组件查看单个输入列并对其进行验证,根据每一行的值创建一个 bool 类型的输出列.

I'm trying to build a simple custom SSIS component which looks at a single input column and validates it, creating an output column of type bool depending on the value of each row.

我已经成功地构建了一个更简单的组件,它接受一个值并转换它:不需要摆弄输出列.在这种情况下,我需要接收一个字符串并输出一个布尔值,组件需要知道它输出一个布尔值,以便我可以将该值输入到条件拆分中.

I've successfully built an even simpler component that takes a value and transforms it: that doesn't require fiddling with the output columns. In this instance I need to take in a string and output a boolean and the component needs to know that it outputs a boolean so I can feed the value into a conditional split.

我正在努力添加输出列.基于来自微软的代码示例,我做到了:>

I'm struggling to add the output columns. Based on code samples from Microsoft, I have done this:

public override DTSValidationStatus Validate()
{
    IDTSOutput100 output = ComponentMetaData.OutputCollection[0];

    IDTSOutputColumn100 outputcol = output.OutputColumnCollection.New();
    outputcol.Name = "IsValid";
    outputcol.SetDataTypeProperties(DataType.DT_BOOL, 0, 0, 0, 0);

    return DTSValidationStatus.VS_ISVALID;
}

然后我尝试在 ProcessInput 步骤中填充它:

And then I attempt to populate it during the ProcessInput step:

public override void ProcessInput(int inputID, PipelineBuffer buffer)
{
    while (buffer.NextRow())
    {
        string str = buffer.GetString(0);
        buffer.SetBoolean(0, IsValid(str)); // validation code not relevant
    }
}

当我尝试在包中使用此组件时,出现此错误:

When I try to use this component in the package, I get this error:

The component has detected potential metadata corruption during validation.
Error at Data Flow Task [Uppercase [24]]: System.MissingMethodException: Method not found: 'Void Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSOutputColumn100.SetDataTypeProperties(Microsoft.SqlServer.Dts.Runtime.Wrapper.DataType, Int32, Int32, Int32, Int32)'.
   at EmailValidation.Uppercase.Validate()
   at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostValidate(IDTSManagedComponentWrapper100 wrapper)

搜索此错误消息没有产生任何价值.

Searching on this error message has yielded nothing of value.

在原始示例和其他一些在线教程中,添加输出列是通过循环输入列并为每个列添加额外输出来完成的.我试过这个并得到同样的错误.

In the original sample - and some other tutorials online - adding output columns is done by looping through the input column and adding an additional output for each. I have tried this and get the same error.

我还尝试将输出列代码从 Validate 移动到 OnInputPathAttached,但仍然会产生相同的错误.

I have also tried moving the output column code from Validate to OnInputPathAttached which still yields the same error.

我做错了什么?

推荐答案

经调查,这似乎是 Visual Studio 2015 的 SQL Server Data Tools 中的一个错误.我在Visual Studio 2013 中的 Integration Services 包.但是,2015 年包中部署的相同工具会导致上述错误.

On investigation this appears to be a bug in SQL Server Data Tools for Visual Studio 2015. I have built, deployed and used a custom component with customised output columns in an Integration Services package in Visual Studio 2013. However, the same tool deployed in a package in 2015 causes the error described.

这篇关于在自定义 SSIS 组件中找不到 SetDataTypeProperties 方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆