I am using SSIS in VS 2012, and a lot of the answers I'm finding appear to be working for older or newer versions.
I have declared a ReadWriteVariables called User::Weather_XML
(I hope this displays - my company policy doesn't allow access to imgur, so it looks like it works, but I can't tell.)
I've looked at a lot of answers: Reading object variable values in SSIS script component source - this refers to Dts.Variables, which apparently is no longer available in 2012?
So my code has this, but it won't compile because Dts.Variables doesn't exist in the current context:
DataTable dt = new DataTable();
OleDbDataAdapter oleda = new OleDbDataAdapter();
oleda.Fill(dt, Dts.Variables("Weather_XML").Value);
How do I get the set of data into the Script Component so I can use it?
I have a data set, with an URL string - I want to go through the list and use each URL, get the corresponding XML, and then save that back to my object. Or write it to a database, or something. It seems like it's just the syntax, but I can't figure it out.
This uses a IDTSVariables100, but then references it to a string, and I have an entire object, with strings within it. If I add the code
IDTSVariables100 varCollection = null;
this.VariableDispenser.LockForRead("User::Weather_XML");
it does compile, so it's progress.
I am very weak in C#. Obviously. What is the syntax needed in 2012 to get the Object variable into something I can use in the Script Component? With, perhaps some guidance on accessing a specific part of the object. Pretend that the URL is the first string field in the object, and I currently have 4 rows.
Also, I include the following namespaces, probably way more than I need:
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
using Microsoft.SqlServer.Dts.Runtime.Wrapper;
using System.Net;
using Microsoft.SqlServer.Dts.Runtime;
using System.Windows.Forms;
using System.IO;
using System.Web.Script.Serialization;
using System.Xml;
using System.Xml.Serialization;
using System.Collections.Generic;
using System.Data.OleDb;