无法使用脚本任务将更新的值分配给ssis变量

时间:2019-01-16 11:20:23

标签: c# sql-server ssis

我创建了一些变量,并使用C#脚本任务试图修改变量的值。 初始值

用于pine变量的Expression Builder图像

enter image description here     FolderInputPath =“ D:\”;     Pine =“ C:\ abc \ qwr”;

请找到变量状态

enter image description here

上述值是在sis软件包中的变量处设置的

console.log(Highcharts.maps['custom/world'].features);

Highcharts.maps['custom/world'].features.push({
   "type":"Feature",
   "id":"ES",
   "properties": {
          "hc-group":"admin0",
          "hc-middle-x":0.76,
          "hc-middle-y":0.27,
          "hc-key":"es",
          "hc-a2":"ES","name":"Spain",
          "labelrank":"2",
          "country-abbrev":"Sp.",
          "subregion":"Southern Europe",
          "region-wb":"Europe & Central Asia",
          "iso-a3":"ESP","iso-a2":"ES","woe-id":"23424950",
          "continent":"Europe"
    },
    "geometry":{
       "type":"MultiPolygon",
       "coordinates":[
    [
     [
      [4045, 7594],
      [4021, 7599],
      [4011, 7621],
      [3984, 7629],
      [3997, 7692],
      [3998, 7762],
      [4020, 7781],
      [4009, 7795],
      [3944, 7795],
      [3930, 7838],
      [3969, 7860],
      [3988, 7852],
      [4098, 7851],
      [4151, 7846],
      [4203, 7821],
      [4246, 7818],
      [4249, 7812],
      [4255, 7814],
      [4262, 7812],
      [4262, 7813],
      [4262, 7814],
      [4263, 7812],
      [4263, 7812],
      [4279, 7808],
      [4298, 7812],
      [4300, 7795],
      [4265, 7771],
      [4233, 7763],
      [4194, 7709],
      [4211, 7683],
      [4189, 7669],
      [4183, 7644],
      [4154, 7635],
      [4143, 7615],
      [4072, 7613],
      [4046, 7594],
      [4045, 7594]
     ]
    ]
   ]
   }
});

根据上述逻辑,我们string filename = ""; string newname=""; filename = Dts.Variables["User::FolderInputPath"].Value.ToString(); if (filename.Substring(filename.Length - 1, 1) != "\\") { filename = filename + "\\"; } newname = filename + "Pine.txt"; Dts.Variables["User::Pine"].Value = newname; MessageBox.Show(newname + " before value is " + Dts.Variables["User::Pine"].Value.ToString()); 的值应为“ D:\ Pine.txt”,但是当我运行代码时,变量User::Pine的值不会改变

enter image description here

预先感谢

1 个答案:

答案 0 :(得分:1)

打开变量窗格,单击变量,然后按F4键打开“属性”窗口。

确保将“ EvaluateAsExpression”和“ ReadOnly”都设置为 False 。另外,请确保“表达式”字段为(如下图所示)。如果不是,请选择文本并删除。

![enter image description here

相关问题