variables
(0). The variables collection's first element is a and its value is set to 25.
Similarly, the value of y is set to 10 through the variable b. Since c is of type
Integer, the variables are changed to Integer by casting.
9. Click on the OK button on the Script Task Editor.
10. Build the project and execute the "Calculate Using Variables" Script Task.
The program cranks up, the script Component turns green and soon you will
see a pop-up window showing 250.
What if you don't include the variables a, and b in the Script Task Editor?
Package with a Script Task
[ 280 ]
Well, when you try to execute the Script Task you will see the following message
delivered by the DTS Script Task Runtime Error, which in this case appears to be
quite meaningful.
Add an Imports Statement to Build a String
1. Repeat the previous steps to configure a new Script Task whose Name is
"String Builder Task", having a Description "Build a string of numbers".
2. Change the PrecompileScriptIntoBinaryCode line item to false in the Script
list item of the Script Task Editor, and click on the Design Script??¦ button
3. In the Microsoft Visual Studio for Applications, type in the following code
in the appropriate location as shown in the following paragraph.
Public Sub Main()
'
'Add your code here
'
Dim i As Integer
Dim sb As New StringBuilder("", 200)
For i = 0 To 15
If i = 15 Then
sb.Append(i)
Else
sb.Append(i)
sb.Append("|")
Chapter 19
[ 281 ]
End If
Next
MsgBox(sb.
Pages:
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197