【问题标题】:SSIS Package Error - Executing through C# Console ApplicationSSIS 包错误 - 通过 C# 控制台应用程序执行
【发布时间】:2024-01-23 12:38:01
【问题描述】:

我是这个线程的新手,我陷入了需要通过 C# 控制台应用程序执行 SSIS 包的情况。

以下是我用来执行包的代码。

Package pkg;
Application app;
DTSExecResult pkgResults;

pkgLocation =@"D:\MIS Reports\TERADATA\Daily_CBASQ1_Loading.dtsx";
app = new Application();
pkg = app.LoadPackage(pkgLocation, null);
pkgResults = pkg.Execute();

但它会引发错误:

The package failed to load due to error 0xC0011008 
"Error loading from XML. No further detailed error information can be specified for this problem because no Events object was passed where detailed error information can be stored." 

CPackage::LoadFromXML fails 时会发生这种情况

请帮忙!

【问题讨论】:

标签: c# ssis dts


【解决方案1】:

这更像是评论,但想发布可能有助于调试的代码

您可以添加 EventListener,它可以帮助您捕获实际错误。

  class MyEventListener : DefaultEvents
      {
        public override bool OnError(DtsObject source, int errorCode, string subComponent, 
          string description, string helpFile, int helpContext, string idofInterfaceWithError)
        {

          Console.WriteLine("Error in {0}/{1} : {2}", source, subComponent, description);
          return false;
        }
      }

现在像这样调用包并更新有问题的实际错误

 MyEventListener eventListener = new MyEventListener();
pkgLocation =@"D:\MIS Reports\TERADATA\Daily_CBASQ1_Loading.dtsx";
app = new Application();
pkg = app.LoadPackage(pkgLocation, eventListener);
pkgResults = pkg.Execute(null, null, eventListener, null, null);

【讨论】:

  • 我的控制台应用程序中已经有这段代码,但问题仍未解决,但感谢您的评论。
  • 没有问题不应该通过添加此代码来解决,而是您应该能够获得有关错误的更多信息...如果您有此代码,您可以发布错误...另外,您的问题我没有看到这段代码这就是为什么建议它
【解决方案2】:

请在下面找到我的代码:

    static void Main(string[] args)
    {
        string pkgLocation;
        Package pkg;
        Application app;
        DTSExecResult pkgResults;
        MyEventListener eventListener = new MyEventListener();


        pkgLocation =@"D:\MIS Reports\TERA DATA\Daily_CBASQ1_Loading.dtsx";
        app = new Application();
        pkg = app.LoadPackage(pkgLocation,eventListener);
        pkgResults = pkg.Execute();

        Console.WriteLine(pkgResults.ToString());
        Console.ReadKey();
    }
}

class MyEventListener : DefaultEvents
{
    public override bool OnError(DtsObject source, int errorCode, string subComponent,
           string description, string helpFile, int helpContext, string idofInterfaceWithError)
    {
        // Output Error Message
        Console.WriteLine("Error in {0}/{1} : {2}", source, subComponent, description);
        return false;
    }
}

错误:

由于错误 0xC0010014 “发生一个或多个错误。在此错误之前应该有更具体的错误来解释错误的详细信息。此消息用作遇到错误的函数的返回值。 ”。当 CPackage::LoadFromXML 失败时会发生这种情况。

【讨论】:

    最近更新 更多