更改 SSIS dts 变量 [英] Changing an SSIS dts variables

查看:40
本文介绍了更改 SSIS dts 变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 SSIS 包中,我有一个 For..Each 容器,用于枚举文件夹中的所有 (.) 文件.

在那个 For..Each 容器中,我有一个组件级变量 'fileComments' 的 DataType 'String'.

在那个 For..Each 容器中,我有一个脚本任务.带有文件注释"的读写条目(以及其他)

在那个脚本任务中,我有一些代码:-

Dim Comments As String = Dts.Variables("User::fileComments").ToString

它允许我读取该变量的值,但是如果我尝试将一个值分配回该变量,我会得到一个 属性 'Item' 是 'ReadOnly' 蓝色波浪下划线.

如何更改该变量的值(或从脚本任务中获取值,以便稍后在流程中使用它)?

提前致谢.

解决方案

你的问题是一个常见的陷阱,看看这篇文章:

http://www.programmersedge.com/?p=1350

你基本上需要在脚本任务中使用 Dts.VariableDispenser 对象来锁定或声明变量为读/写.

In an SSIS package I have a For..Each container that enumerates all (.) the files in a folder.

In that For..Each container I have a component-level variable 'fileComments' of DataType 'String'.

In that For..Each container I have a script task. With a ReadWrite entry for 'filecomments' (amongst others)

In that script task, I have some code :-

Dim Comments As String = Dts.Variables("User::fileComments").ToString

which allows me to read the value of that variable, but if I try to allocate a value back to that variable, I get a Property 'Item' is 'ReadOnly' blue squiggly underline.

How do I change the vlaue of that variable (or get the value out of the script task so I can use it later in the flow) ?

Thanks in advance.

解决方案

your problem is a common trap check this article out:

http://www.programmersedge.com/?p=1350

you basically need to use the Dts.VariableDispenser object to lock or declare the variable as read / write in the script task.

这篇关于更改 SSIS dts 变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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