In the While??¦End, While block pulls out the employees' Last Name one-byone
and displays them in a Script Task window.
4. Click on the OK button in the Script Task Editor window to close
the window.
5. Build and execute the Script Task, "Get Employees Task".
The program starts running and soon you will see the Last Name of the employees
from the employee's table displayed in the Script Task message window. The first
message displays the number of columns retrieved (which is 1 in this example). The
second and subsequent message boxes that pop up display the employees, names
one-by-one as the variable j is cycled in the loop.
??? ??? ??? ??? ??? ??? ??? ??? ???
Package with a Script Task
[ 284 ]
Combine the Last Two Examples in
Displaying Data and Copying to a File
1. Repeat the previous steps to configure a new Script Task whose Name is
"Copy Employees names to a file" having a Description "Get last names
from MyNorthwind database's Employees table and write to a text file".
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 con As New SqlClient.SqlConnection
con.ConnectionString = "Data Source=.;User ID=sa;
password=venugopal;Initial Catalog=MyNorthwind;
Persist Security Info=True;"
con.
Pages:
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200