Link to home
Start Free TrialLog in
Avatar of Putoch
PutochFlag for Afghanistan

asked on

SSIS error at System.Data.RBTree`1.GetNodeByIndex(Int32 userIndex)

Hi there,
Im using SSIS 2005 which using a script tasks creates a connection to our server and db and calls a variable to execute a SP. but I keep getting the following error at System.Data.RBTree`1.GetNodeByIndex(Int32 userIndex)
0 rows returned

but I know if I run this query on its own straight from the db it will return rows.
I even added a data flow tasks to call the sp and export all rows to a test table, which it did and then moved to the script tasks but fails again.

now when I run the SP for some previous dates it runs fine.
I just don't know what it could be.
any help please?
thank you.
p
Avatar of Vikas Garg
Vikas Garg
Flag of India image

Hello,
What is your requirement ?
Why do you need to use a Script Task ?

May be
you are trying to read or loop through the rows from datatable. This error states that the datasource(DataTable) is not having any rows. To avoid this exception use this before you read or loop through datatable:
Hide   Copy Code

if(dt.Rows.Count  > 0 ){
     //Do your stuff here.
}
Avatar of Putoch

ASKER

The script task does do a loop and checks what so is being called and runs the sp however I know that there is data there so I can't understand this error.
I saw had actually tried this suggestion earlier, perhaps I had placed if statement at the wrong area, It throw an error again.
Avatar of Putoch

ASKER

also, using script task, (ive inherited this package) as the formatting seems to be setup inside of the script, and the output is put into xml format using a library.
when I added the if(dt.Rows.Count  > 0 ){

around my main script section which calls the SP
and then I closed your suggestion with
} end if

there is an underline error on the if statement then - am I missing something?
Avatar of Putoch

ASKER

So the thing is if I run this script task for say the first 3 weeks of the last month, the package runs successfully, but when It runs for the whole month it causes this error.
I don't understand how it can see there is 0 rows returned when I know the frist 3 weeks when ranhave worked previously, could it be anything else other than this error its given me, could there be an index issue?
ASKER CERTIFIED SOLUTION
Avatar of Putoch
Putoch
Flag of Afghanistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Putoch

ASKER

There had always been information in the dataset I was trying to access, so by checking to do a loop to ignore if there was no rows then skip wouldn't work as suggested. I had to find the row that caused the problem and remove it.