.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

how to store the values in a object variable (package level scope) in a script component

Posted By:      Posted Date: September 21, 2010    Points: 0   Category :Sql Server
I have declared a variable of object type with package level scope.  I want to assign values to this variable inside a script component.  My object should hold 5 columns in a row.  How to implement this ?

View Complete Post

More Related Resource Links

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_95443d5e406b44d

accessing package level variables in a Script Component in 2008 version


how to access the package level variables within a script component in SSIS 2008

How to get the Package level Variable collections (Global Variable) in Script Task


Hi All,

I have the requirement like read all the Variables in Script Component Task, which includes variables available at package level and their values, global variables declared at package.


Currently are two ways to read the variables but which are not suitable for my requirement


1) Mentioning the variables at Script designer window as ReadOnlyVariables or ReadWriteVariables



Error while trying to assign a value to a Read Write variable in SSIS package script component



       I am trying to develop a SSIS package which will read the records from the flat file and insert them into a destination table. I have some validations written in script component. I have declared two Read Write variables with package level scope. when i try to assign a value to the variable in the script component and run the package, the package throws me an error "The collection of variables locked for read and write access is not available outside of PostExecute".


What should be done to over come the problem please help me on this regard 




How to store and retrieve multiple values in a single session variable .


I want to store employee name,designation and department in session variable and
retrieve in another page how to do this.

Script Component - Assigning value to a variable problem


I have a Script Component and in it I want to assign a value from a row to a variable. I am iterating through a For Each Loop, so I am only getting 1 row at a time. I have a variable declared as ScriptedSaleID and the following code in my Input0_ProcessinputRow method:



myvars As IDTSVariables100

        'We lock the variable for writing. 1st parameter is the name of the variable
        VariableDispenser.LockOneForWrite("ScriptedSaleID", myvars)

        'Now we can write the value to the variable
        myvars(0).Value = Row.SaleID

        'Now we unlock the variables

My problem is

How to send any collection object from .NET Application to object variable created in SSIS Package


HI All,

I have a question regarding SSIS -- How to send list object from .NET Application to object variable created in SSIS Package. In List object there are one lack records stored..This list object needs to be passed to SSIS Package. Please reply me back with any suggestion/solutions ...Required ASAP.

Waiting for your replies.





Object Value lost in script component inside for loop container

Hi All,

I need your expert advice here,

I have 5000 records to transform into csv file and due to the application limitation, the upload module to upload those 5000 records only can be done by batch of 100-200 record at one time.

Because of this, i try to use for loop to split the records into a few files e.g EE_1.csv, EE_2.csv.

The records was retrieved and saved into an object variable (ResultSet) before entering the For Loop flow

The issue i encounter, when it was on the 1st loop everything was fine, it is manage to generate X Records i specified but when it go for 2nd loop, the ResultSet is returning 0 Records..when the actual total records is 5000

Anyone can help this newbie what are the mistakes i made ?

The logic is something like

Public Overrides Sub CreateNewOutputRows()
oledbAdapter = New OleDb.OleDbDataAdapter
dataTable = New DataTable

oledbAdapter.Fill(dataTable, Me.Variables.resultset)
StartPoint = Me.Variables.FilesNumber 'To know which row to start
StartPoint = (StartPoint - 1) * Me.Variables.MaxRecord
EndPoint = (StartPoint + Me.Variables.MaxRecord) - 1

If dataTable.Rows.Count - 1 < EndPoint Then
EndPoint = dataTable.R

Data transformation: Sharing object/variable scope between form and dialog (VS2010/VB)


I am writing a class to provide data transformation between two databases with different schema, and have a windows form which tries to do the data translation work, and a modal showDialog which pops up to halt and tweak the process when errors are detected.

The dialog needs to share, tweak, and pass control information to the main form to tweak the transform parameters until everything works OK.  My question is how to best achieve the data sharing since the dialog has separate data scope.  I have been using declarations like the folllowing to successfuly share data and avoid creating public variables:

     Friend importStatusMessage as string

But with all the variables the dialog needs to tweak, it's becoming messy.  Is there any way to declare the entire dialog as 'Friend' so that main form data is in scope to the dialog?  Or, maybe create an object with properties to pass the data, and share only the object?



Scripting: Windows Script Host 5.6 Boasts Windows XP Integration, Security, New Object Model


Windows Script Host (WSH) 5.6, a major upgrade for the WSH environment, provides some significant improvements over previous versions. A brand new security model that is tightly integrated with security in Windows XP allows administrators to place fine-grained restrictions on scripts reducing the risk from malicious code. In addition, local scripts can now run on remote machines, and enhancements to the object model reduce the amount of boilerplate code needed when writing professional code. This overview of WSH 5.6 explains these changes and how .NET and scripting work together.

Dino Esposito

MSDN Magazine May 2002

Top-Level Search Scope not showing in Sub-Site


I've got a site 'B' created under site 'A' in SharePoint. When I'm at Site A, I can search and find things that exist in both A&B. However, when I'm in B, the 'highest' search scope I can pick is 'B.' I'd like to be able to select one step higher so that I can search A&B from any page. Is this possible?

passing object values from server to client problem


I get a message that x_login is not declared.  I added Dim login as String = "123", but that didn't help.  What's the problem?

code behind....

Dim Login = "123"
x_login.Value = loginID


<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<form id="simForm" runat="server" method='post' action='https://test.authorize.net/gateway/transact.dll'>
        <input id="HiddenValue" type="hidden" value="Initial Value" runat="server" />
        <input type='hidden' runat="server" name='x_login' id='x_login' />
        <input type='submit' runat="server" id='buttonLabel' />



Reading values from data access component individually



I am trying to pick data from the database through data access layer and use those values in different text boxes on the page.Basically on a click on the form, modal popup is planned to read the database and put the values into different text boxes which can be latter changed/ updated.

 What I am unable to do is accessing those values on the form itself progamatically. I will be thankful for any ideas and help.

My data access component is as follows:




new SqlParameter ("@reg_id", SqlDbType.Int ));"@reg_id"].Value=reg_id;try




Managing business object locks on application level

Today I worked out simple application side object locking solution for one server scenario. My motivation came from ASP.NET architecture forum thread How to solve concurrent site issue where one user asks for locking solution that works without changing database. Here is my simple and primitive solution that should help this guy out. I added also sample solution to this posting. My solution is simple: Create class for locked items. Create manager class that holds locks and manages them. Clear locks when session ends. Create page to release all locks. If you need something more serious then you should keep locks information in database or better than that - use some lock server. Also you may consider developing WCF service. LockItem class As a first thing let's create class that keeps lock information. I call this class as LockItem. This class doesn't hold references to locked objects - only type and ID as there are many business layers that doesn't use globally unique identifiers for objects. public class LockItem {     public Type ObjectType { get; set; }     public int ObjectId { get; set; }     public string SessionId { get; set; }     public DateTime LockedAt { get; set; } } LockItem class also contains property for session because otherwise it is not possible to kno

'variable' is not declared. It may be inaccessible due to its protection level.

I have been trying to get a value from my sql database to post to the form I have.  I have thought i was pretty close but it keeps giving me the error "User_EmailTextBox is not declared.  It may be inaccessible due to its protection level".  I have been trying to get this to work for a week and I can't seem to figure it out.  Any help would be appreciated.  My code is below.web.config ---------------------------------------------------------------------------- <?xml version="1.0"?> <configuration> <connectionStrings> <add name="ECDRConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename="C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\Data\ECDR.mdf";Integrated Security=True;Connect Timeout=30;User Instance=True" providerName="System.Data.SqlClient" /> </connectionStrings> <system.web> <compilation debug="false" targetFramework="4.0" /> </system.web> <!--Mail settings--> <system.net> <mailSettings> <smtp> <network host="YOUR HOST HERE"/> </smtp> </mailSettings> </system.net> <!--Mail settings--> </configuration> --------------

How to load a new table with the value of a variable from SSIS package?

Hi, i have two variables in a SSIS package Var1 and Var2. Both of these variables have values. is there any way i can put the values of these two variables in a new table? e.g In New table col1 having value of Var1 and col2 having value of Var2. Thanks

Script Component HELP!

Hi Guys, I have some recordset in the data flow. CURRENT Column1 Column2 Column3 Column4 Column5 Column6 Dine In DISCOUNT 20100824 121618 1859 37 Dine In TAX 20100824 121618 1859 -15.8 Dine In TOTAL 20100824 121618 1859 6.77 Dine In TENDER 20100824 121618 1859 63.2 Dine In TAX 20100824 121618 1859 63.2 Dine In DISCOUNT 20100824 121618 1860 37 Dine In TAX 20100824 121618 1860 -15.8 Dine In TOTAL 20100824 121618 1860 6.77 Dine In TENDER 20100824 121618 1860 63.2 Dine In TAX 20100824 121618 1860 63.2 I want to rename the second "TAX" in Column2 with the value of "DELIVERY CHARGE" and i was thinking on how to do this using script component. TARGET Column1 Column2 Column3 Column4 Column5 Column6 Dine In DISCOUNT 20100824 121618 1859 37 Dine In TAX 20100824 121618 1859 -15.8 Dine In TOTAL 20100824 121618 1859 6.77 Dine In TENDER 20100824 121618 1859 63.2 Dine In DELIVERY CHARGE 20100824 121618 1859 63.2 Dine In DISCOUNT 20100824 121618 1860 37 Dine In TAX 20100824 121618 1860 -15.8 Dine In TOTAL 20100824 121618 1860 6.77 Dine In TENDER 20100824 121618 1860 63.2 Dine In DELIVERY CHARGE 20100824 121618 1860 63.2 Thanks in advance,
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend