问题描述
我将两个变量声明为名为a和b的对象",并有一个简单的SQL任务:.
I declare two variables as "Object" named a and b,and have a simple SQL task:.
select code from code_list
使用完整结果集,我试图将结果传递给已声明的变量(a和b),
并在两个不同的foreach循环上的脚本任务中使用它们(a和b).但这没用.
and use them(a and b) on Script Task with two different foreach loops。But it didn't work.
脚本任务:将结果插入到两个不同的表(A和B)中.
Script Task: insert the result into two different tables(A and B).
推荐答案
创建3个类型为Object的变量,仅将其中一个用作ResultSet.然后添加一个脚本任务,然后选择3个变量作为读/写变量".
Create 3 variables of type Object, only use one as ResultSet. Then Add a Script Task, and select 3 variables as Read/Write Variables.
在脚本任务中,创建两个DataTable变量,并用ResultSet变量填充一个表:
Inside the Script Task, Create two DataTable variables, and Fill one table with the ResultSet variable:
然后使用dataTable1.Copy()
方法将第一个DataTable复制到第二个DataTable变量
Then Copy the first DataTable into the second DataTable Variable using dataTable1.Copy()
method
最后,将每个DataTable分配给一个包Variable.
At the end, assign each DataTable to one package Variable.
这篇关于我有两个Foreach循环,它们具有相同的枚举值.那么我该如何处理呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!