SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SSIS : loading data from recordSet (variable :object) by Script task


SSIS : loading data from recordSet (variable :object) by Script task

Author
Message
yassine LD
yassine LD
Grasshopper
Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)

Group: General Forum Members
Points: 17 Visits: 6
Hi,
i was trying to get data from a recordSet variable. but it's not working Ermm

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;

}

Attachments
1111111111.JPG (37 views, 7.00 KB)
2222222222222.JPG (43 views, 35.00 KB)
333333.JPG (24 views, 114.00 KB)
kl25
kl25
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1132 Visits: 1875
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'.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search