This opens the Microsoft Visual Studio for Applications window as shown
in the next screenshot with some template code. It shows up, referencing a
number of libraries as seen in the References node shown expanded in the
screenshot. The Imports statements for the Public Class ScriptMain are also
in this template code. You need to write your code at the position "Add your
code here".
??? ??? ???
Chapter 19
[ 277 ]
4. For this task, just type in the code shown in the next paragraph to replace
the block.
Public Sub Main()
'
' Add your code here
'
Dim a As Integer
Dim b As Integer
a = 5
b = 10
MsgBox (a * b)
Dts.TaskResult = Dts.Results.Success
End Sub
Package with a Script Task
[ 278 ]
5. Click on the OK button on the Script Task Editor window.
For this example, we do not need to go to the Expressions line item.
6. Build the project and execute the "Simple Calculation" Script Task.
You should immediately see 50 in a pop-up Script Task message window.
Calculation using variables
1. Drag and drop a Script Task from the Control Flow Items group from the
Toolbox on to the Control Flow Page of the 'Canvas'.
2. Right-click the Script Task and from the drop-down choose Edit??¦ (or
double-click the Script Task component).
This opens up the Script Task Editor, as shown in the next screenshot. This
window is common to all tasks we are going to test in this package. You can
provide a Name and a Description for this task.
3.
Pages:
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195