Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 Script Component IndexOutOfRangeException

Author  Topic 

hismightiness
Posting Yak Master

164 Posts

Posted - 2007-08-22 : 11:41:45
I must be tired, because when I run a package I have been working on, I am now getting an IndexOutOfRangeException, and I cannot see where in this code it would come from. Can someone please help me open my eyes here? :)

Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
Row.hotrates = GetBoolean(Row.hotrates, Row.hotrates_IsNull)
Row.map = GetBoolean(Row.map, Row.map_IsNull)
Row.overview = GetBoolean(Row.overview, Row.overview_IsNull)
Row.reviews = GetBoolean(Row.reviews, Row.reviews_IsNull)
Row.video = GetBoolean(Row.video, Row.video_IsNull)

If Not Row.starrating_IsNull Then
Try
Row.starrating = Integer.Parse(Row.starrating, Globalization.NumberStyles.Integer).ToString
Catch
Row.starrating = "-1"
End Try
Else
Row.starrating = "-1"
End If
End Sub

Public Function GetBoolean(ByVal strObject As String, ByVal IsObjectNull As Boolean) As String
If Not IsObjectNull Then
Return String.Equals(strObject, "Y").ToString
Else
Return "False"
End If
End Function


This was working before. The moment I moved this (and a few other related items) into its own Data Flow Task, this error popped up.

- - - -
- Will -
- - - -
http://www.strohlsitedesign.com
http://blog.strohlsitedesign.com/
http://skins.strohlsitedesign.com/

mwjdavidson
Aged Yak Warrior

735 Posts

Posted - 2007-08-22 : 12:07:50
In the Inputs and Outputs section of the Script Transformation Editor, check the name of your 'Input' node, and make sure that it corresponds to the autogenerated code. Looking at your code, if it's not called "Input0", that'll be your problem! I'm assuming that you copied and pasted this script transformation from another data flow task...

Mark
Go to Top of Page

hismightiness
Posting Yak Master

164 Posts

Posted - 2007-08-22 : 13:52:52
Well, I deleted the component and recreated it. That did the trick. Otherwise, you are probably right. Thanks!

- - - -
- Will -
- - - -
http://www.strohlsitedesign.com
http://blog.strohlsitedesign.com/
http://skins.strohlsitedesign.com/
Go to Top of Page

mwjdavidson
Aged Yak Warrior

735 Posts

Posted - 2007-08-23 : 06:18:08
Yeah, that's usually a good solution with SSIS!

Mark
Go to Top of Page
   

- Advertisement -