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
PutochAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Vikas GargBusiness Intelligence DeveloperCommented:
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.
}
0
PutochAuthor Commented:
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.
0
PutochAuthor Commented:
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?
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

PutochAuthor Commented:
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?
0
PutochAuthor Commented:
So because I knew there was information in the data set I was calling, I decided to go day by day to see was there one particular day that caused the error.
And so it looks like there was one row in the file for one day that had an issue with it.
and once I removed this row the script ran correctly.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PutochAuthor Commented:
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.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.