C#中调用SSIS包的问题,急急急!!

jabulin 2010-06-09 01:21:40
我用c#调用SSIS包来更新cube数据时总是提示如下错误:
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.".
This occurs when CPackage::LoadFromXML fails.

环境vs2005 ,sql server2008
代码如下:
public int ExecuteSSASDts()
{

//DtsRunTime.Application dtsApplication = new DtsRunTime.Application();
string filepath = "E:\\BACH\\QTY\\MM\\GSCS\\MainSource\\NewSource\\Web\\Dashboard\\Package.dtsx";
if (!System.IO.File.Exists(filepath))
{
return 2;
}
// Call SSIS package from SQL Server.
Microsoft.SqlServer.Dts.Runtime.Application application = new Microsoft.SqlServer.Dts.Runtime.Application();
Package package = application.LoadPackage(filepath, null); //运行到这句就包上面的错误

DTSExecResult result = package.Execute();
if (result.Equals(DTSExecResult.Success))
{
return 1;
}
else
{
return 0;
}
}
...全文
222 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
jabulin 2010-06-10
  • 打赏
  • 举报
回复
感谢几位的帮忙,问题找到了,是因为dll应用的问题,
因为cube是在sql server2008中,所以我的包是用2008写的,代码又是2005的,那我在代码引用DLL的时候引用的是Microsoft.SQLServer.DTSRuntimeWrap.dll 版本 9.0.240.0
代码中的属性与方法也是用的9.0.240.0 版本的,所以报错

解决方法:
删除web.config中9.0.240.0 版本的引用
重新引用10.0.0.0版本dll,如下:
<add assembly="Microsoft.SqlServer.Dts.Design, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
<add assembly="Microsoft.SqlServer.DTSPipelineWrap, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
<add assembly="Microsoft.SqlServer.DTSRuntimeWrap, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/></assemblies>
代码调整部分:
改动前:

public int ExecuteSSASDts()
{
Application app = new Application();
//DTS包所在位置
String strDtsFilePath = //包的位置
if (!System.IO.File.Exists(strDtsFilePath))
{
return 2;
}
//处理包
Package package = app.LoadPackage(strDtsFilePath, null);
DTSExecResult result = package.Execute();
if (result == DTSExecResult.Success)
{
return 1;
}
else
{
return 0;
}
}

修改后代码:

public int ExecuteSSASDts()
{
string filepath = \\包的位置
if (!System.IO.File.Exists(filepath))
{
return 2;
}
// Call SSIS package from SQL Server.
Application application = new ApplicationClass();
IDTSPackage100 package = application.LoadPackage(filepath,false,null);

DTSExecResult result = package.Execute();
if (result.Equals(DTSExecResult.DTSER_SUCCESS))
{
return 1;
}
else
{
return 0;
}
}

这个问题困扰了我好久,现发出来与大家共享,希望能给一些想我一样的菜鸟一些帮助


jabulin 2010-06-09
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 wuyq11 的回复:]
从XML加载错误
检查LoadFromXML
[/Quote]
请问如何检查?
wuyq11 2010-06-09
  • 打赏
  • 举报
回复
从XML加载错误
检查LoadFromXML
宝_爸 2010-06-09
  • 打赏
  • 举报
回复
Couple of known issues that can cause the same 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.". This occurs when CPackage::LoadFromXML fails.
}

http://support.microsoft.com/?id=913817
http://support.microsoft.com/?id=918038

Just make sure that those registry permissions and the misformatted formatted date time isn't causing the issue, since those are easy fixes.

110,571

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧