Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

SSIS : loading data from recordSet (variable :object) by Script task Expand / Collapse
Author
Message
Posted Thursday, March 13, 2014 8:30 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, March 13, 2014 8:53 AM
Points: 1, Visits: 6
Hi,
i was trying to get data from a recordSet variable. but it's not working

Code :


public void Main()
{

OleDbDataAdapter A = new OleDbDataAdapter();
System.Data.DataTable dt = new System.Data.DataTable();
A.Fill(dt, Dts.Variables["User::Var1"].Value);
// TODO: Add your code here

foreach (DataRow row in dt.Rows)
{
string DeviceID;
object[] array = row.ItemArray;
DeviceID = array[0].ToString();
// I Declare both variables ID And Name as String, So I can show in Messagebox. You can Declare ID as INT and set the value and use
//However you want to use.
MessageBox.Show("ID Value=" + DeviceID);
}

Dts.TaskResult = (int)ScriptResults.Success;

}


  Post Attachments 
1111111111.JPG (1 view, 7.86 KB)
2222222222222.JPG (1 view, 35.96 KB)
333333.JPG (1 view, 114.08 KB)
Post #1550747
Posted Friday, March 14, 2014 9:33 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Friday, July 25, 2014 8:32 AM
Points: 488, Visits: 1,859
Two different approaches presented in these articles:
SSIS 101: Object Variables, ResultSets, and Foreach Loop Containers
SSIS Design Pattern - Read a DataSet From Variable In a Script Task

If these approaches don't meet your need, try searching for 'SSIS shredding a recordset' or 'SSIS shredding an object'.
Post #1551209
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse