Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7445273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:46:58+00:00 2026-05-29T11:46:58+00:00

I have a package i am using the foreach loop to loop through the

  • 0

I have a package i am using the foreach loop to loop through the databases. I am passing a string and it loops though all the databases. Everything is perfect till here.

What i want to achieve is that for each databases it loops, it should increment a variable by 1. suppose if i have to loop through a total of 5 databases. And a package level variable(myvariable =24) is declared as 24. for each databases it loops it should increment the variable by 1.

For that i have created a script task inside the foreachloop container. ReadWriteVariables as myvariable. In the script editor. I have the following code

public void Main()
        {
     int varbl = Convert.ToInt32(Dts.Variables["User::myvariable"].Value.ToString());
     varbl++
       }

and then i am passing that incremented value to a storedprocedure. But its not incrementing. It is still taking the default value of 24. Any ideas how can i increment a variable in foreachloop container?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T11:47:02+00:00Added an answer on May 29, 2026 at 11:47 am

    The variable varblthat you created only exists in the script context.

    To increment the SSIS variable you need to do something like

    public void Main()
    {
        int varbl = Convert.ToInt32(Dts.Variables["User::myvariable"].Value.ToString());
        varbl++;
        Dts.Variables["User::myvariable"].Value = varbl;
    }
    

    or the variable User::myvariable will not be changed

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created an installation package using Wix which installs a Windows service on
I have installed the vim-latex package using Ubuntu Synaptic package manager and updated my
I was wondering if it's possible to have a java package setup using a
I'm using nose and coverage to generate coverage reports. I only have one package
I have an SSIS package that queries data from a view using an SQL
I have created an ActiveX dll using VB6 and packaged it using the Package
when calling a SSIS package (C# app) using LoadFromSqlServer, does the user account have
I have a WSI installer package that I'm using to install my application. The
I am using Ubuntu 9.04 I have installed the following package versions: unixodbc and
I'm working with SOAP using the javax.xml.soap package. I have a javax.xml.soap.SOAPMessage object that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.