SSIS- ADODB Recordset Error - ssis

I am getting below error while running my ssis package.
Error: COM error object information is available. Source: "ADODB.Recordset" error code: 0x800A0BCD Description: "Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.".
I am storing a value in an object variable using RecordSetDestination. And I am passing the object variable in 3 ForEachLoop containers and I am trying to run it parallel. If one of the container is passed then the rest of them getting failed.
Below is the same configuraiton in all 3 ForEachLoop's
Any property needs to change or object variable need to rest or we can't use the object variable for parallel exec in ForEach ADO Enumerator.
Need your input here... Thanks

The problem is the variable for the recordset.
The first option would be you add three data flows like origins pointing each one to a different variable.
The second is adding a multicast in your initial data flow, with three outputs, each one pointing to a different variable.
Then you go to each Foreach Loop Container and set the respective variable in the Enumerator configurarion section.

As Ferdipux proposed, try to run Foreach Loops sequentially. This worked for me.

Related

SSIS Setting OLE_DB Connection string from variable is not working getting error code dts_e_cannotacquireconnectionfromconnectionmanager

I have a parent child package situation where the parent is reading a SQL Server task table. Loops through the tasks and gets the connection string needed for the the task and passes it to the child package. I have created and set a variable in the parent package. I have also created and set a variable n the child package in a Script Task. The Variable is set to the Connection String of my OLE_DB connection in an expression (Package.DelayValidation = True). After the Script task runs(and works..I displayed a message box with the correct value) I run a Data Flow Task which trys to read the database using the connection string. This is where the "error code dts_e_cannotacquireconnectionfromconnectionmanager" happens. I know I have to be missing something, just can not put my finger on it.
Since both packages are available in a single project, try to select Project Reference ,in the parent package, as the ReferenceType and in the PackageNameFromProjectReference enter your child .

Result Set to multiple variables

I am running that uses multiple Foreach Loop Containers and want to run them simultaneously. However, I get the error message -
COM error object information is available. Source:
"ADODB.Recordset" error code: 0x800A0BCD Description: "Either BOF or
EOF is True, or the current record has been deleted. Requested
operation requires a current record."
Obviously, once one Foreach Loop process completes the result set gets dropped.
To get around this I assumed you can pass the same data to different variables like so -
Then in each of the loops just change the DBList, with one Foreach Loop being DBList and the other DBList2 -
However, I receive the error message -
There is an invalid number of result bindings returned for the
ResultSetType: "ResultSetType_Rowset".
Is it impossible to run multiple Foreach Loops concurrently?
You can run foreach loops concurrently, but you have to get your resultset into multiple object type variables and you also have to have 2 sets of variables you would use for the variable mappings for each of the foreach loops.
Example:
Your data flow will consist of a source, multicast and 2 different RecordSet destinations:
The example source here is just returning 1 column of a list of numbers. We multiple cast that into 2 separate RecordSet Destinations that are then assigned to their own object variable type. In this example I have 2 variables, User::RecordSet1 and User:RecordSet2.
Then each of the foreach loops is configured to each of those variables:
Then you have separate variables for each of the foreach loops:
From there you'll need to make sure you're using the appropriate set of variables in whatever code you have in each of the foreach loops.
Instead of using an Execute SQL Task, create a Data Flow, and then use a SQL Query as your Source (probably OLE DB Source). Then pipe that to a Multicast, with outputs to two different Recordset Destinations. In the Component Properties tab, set the VariableName to one of your object variables, then click on the Input Columns to choose which columns you want to include. Do the same for the other Recordset Destination, choosing your second object variable this time, and again selecting which columns to include. Then go back to your Control Flow and link the Data Flow you just created to your two Foreach Loop Container.

SSIS - Error when passing object from one script task to another

I am passing object of a class from one script task to another. I have declared a package level variable by the name IPSService which is of type object.
The first script task contains the following piece of code
IPSService iPSService = new IPSService();
Dts.Variables["IPSService"].Value = iPSService;
I get an exception at the second line of code where the assignment happens.
The error message is as follows.
he 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.
Could somebody tell me what the issue is ?
You need to refer to the variable like this, notice the use of User:: in the variable name:
Dts.Variables["User::IPSService"].Value = iPSService;

The type of the value being assigned to variable differs from the current variable type

My SSIS package fails with the error:
The type of the value being assigned to variable differs from the
current variable type.
I declared a variable of type string and corresponding column name in SQL table is varchar(33). If I use data type as object it succeeds but again i need to use the variable value in an expression for connection string and there object type is not supported.
Please help me how to proceed.
Note: The goal of my SSIS package is to get server list from a table (that's where it fails) and execute some script with a foreach loop container in all the servers.
If I'm reading your question right, what you actually need are two variables: one is an Object variable that receives the data from your SQL table, and one is a String value that you will pass to your ForEach loop.
The difference between them is that your Object variable can hold multiple rows, while your String value can only hold a single item at a time. What you will do is declare an Object variable, populate it with a list of the servers, then use a ForEach loop to step through each item in the list, feeding the values one at a time to your String variable. You will then use the String variable to set up the script you mentioned, and execute it once per server.
For further reading, there is an excellent walkthrough here that will give you screenshots and examples of what I am talking about.
I know i am replying to this thread very late, below explanation is for people who see this in future.
I encountered this situation recently. I did the below
Firstly my Record Set Destination Variable of object type. Using For Each Loop container, i mapped each and every row data(with multiple columns) to an variable(s) of OBJECT type. When i use any other datatypes other than OBJECT datatype for variable(s) i got the error as below
Error: ForEach Variable Mapping number 3 to variable "User::EMPID" cannot be applied.
Then I used the variable(s) of object type in my Execute SQL Task and it inserts data successfully without any error.
Thumb Rule: Map Record Set Destination output to the variable of
OBJECT type.
I encountered this situation recently. I did the below
Firstly my Record Set Destination Variable of object type.
Using For Each Loop container, i mapped each and every row data(with multiple columns) to an variable(s) of OBJECT type. When i use any other datatypes other than OBJECT datatype for variable(s) i got the error as below
Error: ForEach Variable Mapping number 3 to variable "User::EMPID" cannot be applied.
Then I used the variable(s) of object type in my Execute SQL Task and it inserts data successfully without any error.
Thumb Rule: Map Record Set Destination output to the variable of OBJECT type.

SSIS - How to access resultset data in script task that is contained in Foreach loop container?

I've two nested foreach loop containers. Each are looping on different resultsets. I've a script task, within the inner foreach loop container, in which I need to be able to acccess values of current row of both the loops. One way of doing it is using variable mappings on both the loops, but is there a way to access current row from within the script? any ideas?
You can access variables mapped in loop containers in script task via Variables property of the Dts object if you add this variables to ReadOnlyVariables or ReadWriteVariables lists in the Script Task Editor.
Map current row of each loop to variable and then access this variables in script task. Isn't this enough?
Example:
string fileName = (string) Dts.Variables["FileName"].Value;
You can read more here: http://msdn.microsoft.com/en-us/library/ms135941.aspx
Update:
You can map whole row to variable at once. Use Object as variable type and set Index = -1 in Variable mappings in Foreach loop.You should receive enumerator, which type is related to enumerated collection.