Sql server 尝试执行时如何知道SSIS运行包问题
我尝试使用以下代码运行SSIS:Sql server 尝试执行时如何知道SSIS运行包问题,sql-server,ssis,etl,ssis-2012,Sql Server,Ssis,Etl,Ssis 2012,我尝试使用以下代码运行SSIS: public class EjecutaPaquete { private Microsoft.SqlServer.Dts.Runtime.Package pkgPaquete; private Application appAplicacion; public DTSExecResult EjecucionPaquete(string str_Paquete, List < CatVariablesEtl > Va
public class EjecutaPaquete {
private Microsoft.SqlServer.Dts.Runtime.Package pkgPaquete;
private Application appAplicacion;
public DTSExecResult EjecucionPaquete(string str_Paquete, List < CatVariablesEtl > Vars = null) {
DTSExecResult respuesta;
try {
appAplicacion = new Application();
appAplicacion.PackagePassword = "mypass";
pkgPaquete = appAplicacion.LoadPackage(str_Paquete, null);
foreach(CatVariablesEtl item in Vars) {
pkgPaquete.Variables[item.str_NombreVariable.ToString()].Value = item.str_ValorVariable.ToString();
}
respuesta = pkgPaquete.Execute();
return respuesta;
} catch (Exception ex) {
throw new NotImplementedException();
}
}
公共类EjecutaPaquete{
私有的Microsoft.SqlServer.Dts.Runtime.Package pkgPaquete;
私有应用程序;
公共DTSExecResult ejeucionPaquete(字符串str_Paquete,ListVars=null){
DTSEcressult respuesta;
试一试{
AppApplication=新应用程序();
appaplicion.PackagePassword=“mypass”;
pkgPaquete=appaplicion.LoadPackage(str_Paquete,null);
foreach(变量中的CatVariablesEtl项){
pkgPaquete.Variables[item.str_NombreVariable.ToString()]。Value=item.str_ValorVariable.ToString();
}
respuesta=pkgPaquete.Execute();
返回respuesta;
}捕获(例外情况除外){
抛出新的NotImplementedException();
}
}
它将所有变量正确地读入foreach,问题是当尝试执行packagerespuesta=pkgPaquete.execute();
首先返回successed
,但当它返回“respuesta”时,它得到失败
您可以从包中读取错误。错误
属性:
代码示例:
foreach(DtsError item in package.Errors) {
Console.Writeline(item.description);
}
必须使用具有相同变量值的visual studio调试ssis包