本文介绍了如何显示包进度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们必须多次运行SSIS包并且必须查看进度。

我准备了包并创建了日志,它将捕获开始时间,结束时间。

例如,下面是我的表输出



选择*来自packagelog



ID PackageName Starttime结束时间状态

1 A 4:17 PM 4:18 PM已完成

2 B 4:18 PM 4:24 PM已完成

3 C 4: 24 PM 4:32 PM进展

4 D 0 0未开始

5 E 0 0未开始





我需要使用.net或C#向前端的用户显示此输出。

是否有任何参考文章可以创建它。

We have to run a SSIS package multiple times and have to view the progress.
I have prepared the package and have created log which will capture the starttime , end time.
For example, below is my table output

Select * from packagelog

ID PackageName Starttime Endtime Status
1A4:17 PM 4:18PM Completed
2B4:18 PM 4:24PM Completed
3C4:24 PM 4:32PM Inprogress
4D0 0 Not Started
5E0 0 Not Started


I need to show this output to the users on a frontend using .net or C#.
Is there any reference article for creating this.

推荐答案

var commandText = "SELECT * FROM dbo.PackageLog";
var connectionString = ConfigurationManager.ConnectionStrings["localDatabse"].ConnectionString;

DataTable dataTable = new DataTable();

using (SqlConnection sqlConnection = new SqlConnection(connectionString))
{
    using (SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(commandText, sqlConnection))
    {
        sqlDataAdapter.Fill(dataTable);
    }
}

Console.WriteLine("ID   Package Name     Start Time              End Time                Status");
Console.WriteLine("---  ---------------  ----------------------  ----------------------  --------");

foreach (DataRow dataRow in dataTable.Rows)
{
    Console.WriteLine(
        "{0}  {1}  {2}  {3}  {4}",
        ((int)dataRow[0]).ToString().PadRight(3),
        ((string)dataRow[1]).PadRight(15),
        ((DateTime)dataRow[2]).ToString().PadRight(22),
        (dataRow[3] is DBNull) ? String.Empty.PadRight(22) : ((DateTime)dataRow[3]).ToString().PadRight(22),
        (string)dataRow[4]);
}

Console.ReadKey();


这篇关于如何显示包进度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 16:02