简体   繁体   English

从C#执行程序包时,如何将SSIS日志信息发送到文本框?

[英]How do I send SSIS log information to a text box when executing a package from C#?

I have a button that, when clicked, will execute an SSIS package at a location specified by the user. 我有一个按钮,当单击该按钮时,它将在用户指定的位置执行SSIS程序包。 This functionality works fine, but what I am particularly interested in is relaying information about package execution back to the user in the UI. 该功能运行良好,但我特别感兴趣的是将有关包执行的信息中继回UI中的用户。

Is it possible to write the log messages to a textbox OR somehow display the package execution progress window to the user? 是否可以将日志消息写入文本框,或者以某种方式向用户显示包执行进度窗口?

By "Package Execution Progress" window I mean this window: 通过“打包执行进度”窗口,我指的是此窗口: SSIS包执行进度窗口

I am aware that the Package.Execute() contains an IDTSLogging parameter, but I do not know if that is what I need because I haven't been able to find an applicable code example and I am very new to C#. 我知道Package.Execute()包含一个IDTSLogging参数,但是我不知道这是否是我所需要的,因为我无法找到适用的代码示例,并且对C# 还是陌生的 Most of the code examples I've seen that execute an SSIS package do not include any parameters in the Execute method. 我见过的大多数执行SSIS包的代码示例在Execute方法中均不包含任何参数。

I do not want to write information to a separate log file, as a matter of personal preference. 根据个人喜好,我不想将信息写入单独的日志文件。 I considered writing log output to a file (I have a working example of this I could use) and then reading the contents of that file into the textbox using the File.ReadAllText method, but that seems highly inefficient. 我考虑过将日志输出写入文件(我有一个可以使用的工作示例),然后使用File.ReadAllText方法将该文件的内容读取到文本框中,但这似乎效率很低。 If need be, this may work as a last resort. 如果需要,这可能是万不得已的方法。

Thank you for your time and consideration! 感谢您的时间和考虑!

See this Example , downside is that the log is available after the package is ready. 参见本示例 ,缺点是在软件包准备好后,日志可用。 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM