【发布时间】:2012-06-11 16:55:06
【问题描述】:
我当前的包包含一个 Excel 源、一个脚本组件和一个 OLE DB 目标。我想要完成的只是改造我的一个专栏。对于这个特定的列,我想要该列的子字符串。但是,我不断收到以下错误消息:
There is no current row in the buffer. A row may need to be added using the AddRow method.
at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.HandleUserException(Exception e)
这是什么意思?当我所做的只是转换数据时,为什么我需要添加行?我错过了关于 SSIS 的大局吗?
这是我在脚本中的代码:
public override void Input0_ProcessInputRow(Input0Buffer Row)
{
OutBuffer.labortypewbs = Row.CopyofLevel2ProjectSegment.Substring(Row.CopyofLevel2ProjectSegment.Length - 2, 2);
}
感谢大家的帮助!
【问题讨论】:
-
你能把你写在脚本组件中的代码贴出来
-
@praveen 我很乐意。
-
您需要在将值分配给输出列之前添加行。请在语句 outbuffer.labortypewbs=.........之前添加语句 OutBuffer.AddRow() /跨度>
-
从您所写的内容来看,我认为您可以很好地使用派生列转换并使用 SSIS 附带的 SUBSTRING 函数。如果您想使用该功能,请告诉我们。
标签: sql-server ssis buffer row bids