如何在SSIS中查看com对象内容

时间:2016-10-18 05:35:43

标签: debugging ssis ssis-2012

我正在初始化脚本任务中的Package Scope中的对象变量,之后该变量必须传递给Web Service Task。 当我在脚本任务中初始化后在监视窗口中查看变量的值时,将初始化该对象。 但是,如果在执行后事件后看到相同的变量,则该值仅显示为System._ComObject。如何查看值存储在Object to Watch Window中。

1 个答案:

答案 0 :(得分:1)

使用以下内容解析对象变量并将其输出到平面文件。通过小调整,这应该可以正常工作:

 public override void CreateNewOutputRows()
{
    // Set up the DataAdapter to extract the data, and the DataTable object to capture those results
    OleDbDataAdapter da = new OleDbDataAdapter();
    DataTable dt = new DataTable();

    // Extract the data from the object variable into the table
    da.Fill(dt, Variables.LDAPResultSet);

    // Since we know the column metadata at design time, we simply need to iterate over each row in
    //  the DataTable, creating a new row in our Data Flow buffer for each
    foreach (DataRow dr in dt.Rows)
        //'foreach (DataColumn col in dt.Columns)
        {
            {
                // Create a new, empty row in the output buffer
                LDAPOutputBuffer.AddRow();
                object[] array = dr.ItemArray;
                LDAPOutputBuffer.ADENTName = array[1].ToString();
                LDAPOutputBuffer.DisplayName = array[3].ToString();
                LDAPOutputBuffer.DNName = array[2].ToString();
                LDAPOutputBuffer.Mail = array[0].ToString();
                               }
        }
}

此代码创建一个DataTable并对其进行解析并将其输出到平面文件目标。