SSIS Integration Services | Script tasks exercise | Use a script task to react to user's answer to message box

This exercise is provided to allow potential course delegates to choose the correct Wise Owl Microsoft training course, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.

You can learn how to do this exercise on the relevant Wise Owl classroom training course (sadly for the moment only in the UK).

Software ==> SSIS Integration Services  (46 exercises)
Version ==> SSIS 2012 and later
Topic ==> Script tasks  (1 exercise)
Level ==> Relatively easy

You need a minimum screen resolution of about 700 pixels width to see our exercises. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.

Create a new package called Awaiting instructions, and add 3 script tasks to it:

3 script tasks

The bottom two tasks are just fillers - they won't actually do anything.

You can get the Failure line by adding a normal connector, then right-clicking on it to change its status.

Write script in your Are you feeling lucky? task to ask the following question:

Question asked

The question your message box should display.

 

You can show this question using code similar to this:

// ask user their state of mind

var answer = MessageBox.Show(

"Are you feeling lucky?",

"Question",

MessageBoxButtons.YesNo,

MessageBoxIcon.Question

);

// return success or failure

if (answer == DialogResult.Yes) { ...

Not feeling lucky?  If you answer No to the question, you should go down the Failure path (your script should set its result to Failure, not Success):

Failure path

Of course, if you are feeling more positive and answer Yes, you'll be taken down the left-hand path!  Is your glass half-full or half-empty?

When you've tested both paths, close the package down.

You can unzip this file to see the answers to this exercise, although please remember this is for your personal use only.
This page has 0 threads Add post