Cant see package level variable in script component
I am currently having a issue accessing a package level variable. My package level variable is called RecordSet1 and type object. I was able to use a Data Flow and populate the variable with data with a record set destination. So, now I am writing a script component that makes a recordset as a source(I am new to ssis and I know this has performance issues, I am only doing this to get familiar with scripting cause my manager told me too) So I am not able to access any of the variables. My code is below. I am getting a error on this.Variables.RecordSet1. I looked all over online and unable to really find a solution. I know in script component, you can use the this.Variables.VariableName to access the variables but even my intellisense isn't showing anything. Error 1 'Variables' does not contain a definition for 'RecordSet1' and no extension method 'RecordSet1' accepting a first argument of type 'Variables' could be found (are you missing a using directive or an assembly reference?) C:\Users\Dhinesh\AppData\Local\Temp\SSIS\ee6fc0aaa4f447e0b024451e97f51dec\main.cs 42 39 sc_95443d5e406b44d0aa1f5a3d0df9f7fb using System; using System.Data; using Microsoft.SqlServer.Dts.Pipeline.Wrapper; using Microsoft.SqlServer.Dts.Runtime.Wrapper; using System.Data.OleDb; [Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute] public class ScriptMain : UserComponent { public override void PreExecute() { base.PreExecute(); } public override void PostExecute() { base.PostExecute(); /* Add your code here for postprocessing or remove if not needed You can set read/write variables here, for example: Variables.MyIntVar = 100 */ } public override void CreateNewOutputRows() { OleDbDataAdapter olead = new OleDbDataAdapter(); DataTable dt = new DataTable(); //DataRow row; olead.Fill(dt, this.Variables.RecordSet1 ); foreach (DataRow row in dt.Rows) { Output0Buffer.AddRow(); Output0Buffer.strcol = row["str_col"].ToString(); Output0Buffer.intcol = Convert.ToInt32(row["int_col"]); } } } Sorry, I just figured out what I did wrong after looking at a couple posts above me. I forgot to add the readonlyvariables in the custom properties. I had a problem with this for 3 hours and its such a easy fix. I knew I did something wrong.
October 26th, 2010 12:58am

in the script component you should work with variables like this: http://josef-richberg.squarespace.com/journal/2009/8/12/using-variables-in-ssis-script-component.htmlhttp://www.rad.pasfu.com
Free Windows Admin Tool Kit Click here and download it now
October 26th, 2010 2:41am

I disagree. You should use variables like this: Use ReadOnlyVariables and ReadWriteVariables Properties in Scripts. Talk to me now on
October 26th, 2010 3:08am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics