Create a MessageBox in SSIS with C#


What is wrong with me?!?  Or rather what is wrong with everyone else on the internet?  Why won’t anyone post a little article on how to create a message box in an SSIS package so I can easily google it?  Must I do everything around here?

Confession: I don’t know jack about C#.  Creating a message box is probably one of the most basic tasks ever but having never written any C# I can never remember how to do this and I can never find a blog post on how to do it.  Essentially, when it comes to creating a message box to check the state of a variable in SQL Server Integration Services I’m like the guy in Momento.  (Bam! Momento.  Best amnesia movie ever?  Probably.  Hmm, perhaps I should take a Polaroid of the code to help me remember…)

Why do I have “MessageBox.Show(Dts.Variables[“YourVariableHere”].Value.ToString())” tattooed on my arm?
So without further ado.

  1. Add a Script Task to your Control Flow. Note: “Script Task” not “ActiveX Script Task”.
  2. Open the task and click the “Edit Script” button near the bottom of the window.
  3. Scroll to the bottom of the default code and replace
            public void Main()
            {
                // TODO: Add your code here
                Dts.TaskResult = (int)ScriptResults.Success;
            }

    with

     public void Main()
            {
                MessageBox.Show(Dts.Variables["User::YourVariableNameHere"].Value.ToString());
    
            }
  4. Save and close the ssisscript window.
  5. Then, add your variable to the ReadOnlyVariables section.
  6. Click OK

That should do the trick.  Hopefully, writing this post will do the trick for me and help me remember how to do this (and I won’t have to resort to Polaroids and tattoos.)

 


12 responses to “Create a MessageBox in SSIS with C#”

  1. Заказать диплом института. Покупка документа о высшем образовании через качественную и надежную фирму дарит ряд достоинств. Такое решение позволяет сберечь как личное время, так и серьезные денежные средства. aijobsphilippines.com/employer/eonline-diploma

  2. Play at Pin-Up Casino Canada

    Looking for the best online casino experience in Canada? Pin-Up Casino is your ultimate destination for premium entertainment. Whether you’re a table games fan, Pin-Up Casino offers huge rewards to suit every taste.

    Why Choose Pin-Up Casino?
    Huge Selection of Games: Play live dealer games from world-class developers.
    Generous Bonuses and Promotions: Claim welcome bonuses to maximize your winnings.
    Fast and Secure Payouts: Experience safe transactions with complete peace of mind.
    Mobile-Friendly Gaming: Enjoy seamless gameplay on your phone or tablet.
    24/7 Support: Get expert assistance from the Pin-Up Casino support team whenever you need it.
    How to Get Started at Pin-Up Casino Canada?
    Sign Up: Visit the Pin-Up Casino website and create your account.
    Claim Your Bonus: Take advantage of cashback promotions.
    Explore the Games: Discover slots, table games, poker, and live casino.
    Start Playing and Winning: Spin the reels, place your bets, and unlock massive jackpots.
    Top Games Available at Pin-Up Casino Canada:
    Slots: From progressive jackpot games to high-quality themed slots, there’s something for every player.
    Table Games: Enjoy your favorite casino tables.
    Live Casino: Experience immersive live dealer games with professional dealers.
    Why Pin-Up Casino is Canada’s Favorite Online Casino?
    Pin-Up Casino combines secure gaming to create the ultimate destination for Canadian players. With live dealer options, it’s no wonder Pin-Up is a trusted online casino.

    Don’t Miss Out – Sign Up Now!
    Register and start playing at
    casino pinup
    to claim your bonus and enjoy premium entertainment!

  3. Заказать диплом об образовании. Изготовление документа занимает минимум времени, а стоимость при этом невысокая. Таким образом вы сможете сберечь деньги и время и получить работу мечты. Заказать диплом на заказ возможно через сайт компании. – lider036.5nx.ru/posting.php?mode=post&f=26

Leave a Reply

Your email address will not be published. Required fields are marked *