【问题标题】:how to send file in a specific folder in ssis by script task如何通过脚本任务在 ssis 中的特定文件夹中发送文件
【发布时间】:2020-01-21 13:52:02
【问题描述】:

我想在 ssis 中使用脚本任务在处理后发送特定文件夹中的文件我该怎么做? 谢谢你

【问题讨论】:

  • 您可以使用 SSIS 将文件移动到新文件夹(我实际上建议使用 2 个对象复制然后删除 vs 1 个移动)
  • 您的意思是“发送”带有附件的电子邮件吗?

标签: ssis msbi


【解决方案1】:

移动文件应该不是问题。 Take a look at this。您可以将文件的路径作为变量传递。

    using System.IO;
    string path = (string)Dts.Variables["User::path1"].Value;;
    string path2 = (string)Dts.Variables["User::path2"].Value;;
    try 
    {

        // Ensure that the target does not exist.
        if (File.Exists(path2)) 
        File.Delete(path2);

        // Move the file.
        File.Move(path, path2);

    }

【讨论】:

  • 别忘了使用 System.IO 添加;或使用 System.IO.File.Delete()
  • 谢谢你,太好了
猜你喜欢
  • 2021-05-22
  • 1970-01-01
  • 2013-07-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-04-03
相关资源
最近更新 更多