【问题标题】:How to append to a string with a DTS variable in c#如何在 C# 中附加到带有 DTS 变量的字符串
【发布时间】:2013-11-05 13:42:07
【问题描述】:

嘿,

我的目标是将 SSIS 变量附加到一段字符串(这是来自服务的 XML)。

我尝试过这段代码:

string xml = Encoding.UTF8.GetString(stm.GetBuffer());
StringBuilder sb = new StringBuilder();
sb.Append(xml + "<CC>" + Dts.Variables["User::XX"].Value.ToString() + "</CC>");  

但它根本不会附加 DTS.Variable (*edit AND 也不是 CC 元素)

代码有错误吗?

【问题讨论】:

    标签: c# xml ssis


    【解决方案1】:

    关于 DTS 变量引用,您的语法是正确的。但是,您应该考虑多次调用 Append() 方法才能正确调试。

    还可以考虑使用清晰的语法,例如:

    String xx = (String)Dts.Variables["User::XX"].Value;
    xx = "<CC>" + xx + "</CC>"; //not very clean should use xml types instead
    sb.Append(xml).Append(xx);
    

    第, G.R.

    【讨论】:

      猜你喜欢
      • 2020-03-06
      • 2014-02-17
      • 2013-10-17
      • 1970-01-01
      • 2016-07-14
      • 2022-01-26
      • 1970-01-01
      • 2013-03-26
      • 1970-01-01
      相关资源
      最近更新 更多