SSIS - How to access a RecordSet variable inside a Script Task

后端 未结 3 1462
我寻月下人不归
我寻月下人不归 2020-12-06 09:55

How do you access a RecordSet variable inside a Script Task?

3条回答
  •  忘掉有多难
    2020-12-06 10:17

    Listed below is the code I used to load a datatable in a C# script task from a recordset or resultset variable. "User::transactionalRepDBs" is a SSIS variable of Object (System.Object) that was loaded through a "Full result set" from a execute SQL task script. This link assisted me.

    using System.Data.OleDb;
    
    DataTable dt= new DataTable();
    OleDbDataAdapter adapter = new OleDbDataAdapter();
    adapter.Fill(dt, Dts.Variables["User::transactionalRepDBs"].Value);
    
    foreach (DataRow row in dt.Rows)
    {
       //insert what you want to do here
    }
    

提交回复
热议问题