代码之家  ›  专栏  ›  技术社区  ›  Satishakumar Awati

如何访问脚本任务中的对象ssis变量?

  •  -2
  • Satishakumar Awati  · 技术社区  · 6 年前

    我有类型的ssis变量 对象 它保存来自的OLE DB结果集 OLE DB源 .

    对象是 博客列表 每个博客都有属性 标题 描述 . 如何解析ssis对象变量,并对每个blog和字段进行迭代?

    编辑 :

    我想在脚本任务中读取完整的结果集。

    1 回复  |  直到 6 年前
        1
  •  0
  •   Brad    6 年前
    // this gets the data object and sets ti to a data table
                OleDbDataAdapter A = new OleDbDataAdapter();
                System.Data.DataTable dt = new System.Data.DataTable();
                A.Fill(dt, Dts.Variables["User::SSISObjectVariableFromPackage"].Value);
    
                // for test data
                DataTable sourceTable = dt;
    
                //Now loop through databale and do your processing
    
    
    
    //----------------------------------------------------------------------
    //Updated  -- possible solution to fix issue in comments but left original above as that works for most 
    
    //try this version instead, mabye converting the SSIS variable to a C# object first, and not accessing it directly into the A.Fill may resolve your issue in the comments:
    
    Object OBJDataTableValidFieldListFull = Dts.Variables["User::SSISObjectVariableFromPackage"].Value;
    
        // this gets the data object and sets ti to a data table
                    OleDbDataAdapter A = new OleDbDataAdapter();
                    System.Data.DataTable dt = new System.Data.DataTable();
                    A.Fill(dt, OBJDataTableValidFieldListFull);
    
                    // for test data
                    DataTable sourceTable = dt;
    
                    //Now loop through databale and do your processing