Can multiple branches of a package use the same variables

Can multiple branches of a package use the same variables. I don't want to create new variables for each branch .I am getting an error in one of the script tasks
"The element cannot be found in a collection. This error happens when you try to retrieve an element from a collection on a container during execution of the package and the element is not there." Assuming I dont have a naming error
what else should I look for.

More Related Resource Links

Hi There,
I am fairly new to SSIS. I am creating a number of custom SSIS Tasks that I want to be able to share information between at runtime. I figured that the best way to do this was through package variables, as in the Execute() method each custom task
has access to the package variables through the VariableDispenser object. I have managed to read variables at runtime that I create in the designer, however I am having trouble creating and writing to them. I have created a very simple custom task
below that I would expect to create the specified variable...
[DtsTask(DisplayName = "TestVariableWriter")]
public class Variab : Task
{
public override DTSExecResult Execute(Connections connections, VariableDispenser variableDispenser, IDTSComponentEvents componentEvents, IDTSLogging log, object transaction)
{
try
{
string varName = "TestVariable";
string varValue = "TestValue";
Variables vars = null;
variableDispenser.LockForWrite(varName);
variableDispenser.GetVariables(ref vars);
if (variableDispenser.Contains(varName))
vars[varName].Value = varValue;
else
vars.Add(varName, false, string.Empty, varValue);
vars.Unlock();
return DTSExecResult.Success;
}
catch (Exception ex)
{

Hi all!
In SSIS 2008, within a script component trying to refer to a package level variables that was added to the ReadOnlyVariables collection of the component, the following fails within the AcquireConnnection function and
I get this error:
Error 1
Validation error. Test1: Test1: Microsoft.SqlServer.Dts.Pipeline.ReadOnlyVariablesNotAvailableException: The collection of variables locked for read access is not available at this point. à Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.HandleUserException(Exception
e) à Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.AcquireConnections(Object transaction) à Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostAcquireConnections(IDTSManagedComponentWrapper100 wrapper,
Object transaction)
string connectionString = "DSN=" + this.Variables.MYDSN;
Conn = new OdbcConnection(connectionString);
Conn.Open();
If I move the previous code in the PreExecute function, it runs fine though.
Then, if I move the connectionString variable to the class definition, and populate it from within the PreExecute function and leave the last 2 lines in the AcquireConnection function,
I get the following error:
Error 1
Validation error. Test1: Test1: System.InvalidOperationException: The ConnectionString property

I am using the configuration file to read the connection string in the SSIS packages. In one of my packages i have to use two different connection strings. If i specify the second connection string in the config file, then the current package works well
but other packages fails during validation saying the second connection manager does not exist in the package. Is it not possible to have multiple connection string in a single config file?

I have a package that collects information from an SQL Server about the databases on that server. I store this information in a table from where I can create graphs (for example the disk usage, etc.). Now I would like to run this package for about 20 servers.
The only difference in the package is the connection of the source DB. What would be the easiest way to do this:

1. Build a loop in the package that runs 20 times and putting the server name in a variable

2. Set package configurations that it runs 20 times with every time a different value for the server of the read db component (is that even possible??)

I have an asp.net website in which users can submit reports. Another tester and I tested this page at the same time and when I went to review the information I submitted, it displayed information that I didn't submit. It displayed the info submitted from the other user.

I use session variables for these values. I don't understand how this happened?

What can I do so each user can individually submit their information without overlapping some one else's information? The plan is for multiple users to be able to use this page to submit their weekly layer reports.

The first example of code is how I add the session variables from the textboxes.

In the child packages I use this MyVariable in an expression to build a connection string.

@[User::MyVariable] + "Something"

This works fine, however each time I open the child packages - a couple of errors are shown in the errors pane notifying me that the variable does not exist in the child package. This is correct because it does not - however at runtime the child package
can make use of the variables in the parent ssis package.

I am new to SSIS. I am extracting data from multiple CSV files using SSIS package and copying that data into SQL server 2008 database. Can you please confirm if I can create only one package to handle all CSV files or I will have to create packages for
each CSV file.

I have an existing etl package with data flow components. One of the column is System_id to identify the Source System, the package is pulling the data from. I plan to create a component which will validate the data based on the Rules stored in the
database. These rules will be accessed based on the System_id + Target combination which needs to be set by the user at design time when the component is dropped.

In design time, i want to access this System_id field for the Custom data flow component so that i can access the database table and display the available Targets for this System_id which the user can set so that i can run the rules against this data.

I understand that i cannot access the value of the data flow at design time. My question is there other way, where i can set the variable value and access it at design time ?

While importing I need to perform validation on each file and only extract data that is valid e.g. CNIC column must be numeric and 13 digits long.

Any data that is not valid will be sent to a separate table with same TableName_bad suffix

After the data is extracted I will extract the details data of only those records that have been extracted in master table before

I know about basic data flow controls etc but I don’t know which control will be better for which task. Please tell me what will be the procedure to fulfill my requirements. I will be extremely thankful.

I'm looking for a basic guideline/best practices for creating an SSIS setup involving one "master" package called with one variable that will link it to a set of configurations based on that variable. Currently we create a new package for each
client, each with their own configuration. Now each package is basically the same but we create an entirely new package file for each customer. There are variables that are of the YES/NO variety to enable/disable specific functions based on client need. As
it is now, if we improve the package (a new version if you will) we have to go back to all prior packages to update and make the adjustment. These can be anything from a small SQL code change to an entirely new container of tasks. Either way, you get the idea,
this is very inefficient and I am attempting to standardize our packages and process. If anyone could post a few links or point me in the right direction it would be very much appreciated. Thank you!