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

查看:29
本文介绍了在自定义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.

我正在努力添加输出列.基于来自Microsoft的代码示例,我已经这样做:

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数据工具中的一个错误.是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天全站免登陆