SSIS capturing multiple variables

  • Yes of course, labels are fine now! I tried executing the script task in SSIS and filled in 20 values, clicked on submit, then it hung for a while and gave the attached error:

    My variables are called

    dtsCampaign_Code1

    dtsCampaign_Code2

    dtsCampaign_Code3

    dtsCampaign_Code4

    dtsCampaign_Code5

    dtsCampaign_Code6

    etc

    .

    .

    dtsCampaign_Code20

    I have added them all as readwrite variables in the script task editor so it contains

    User::dtsCampaign_Code1,User::dtsCampaign_Code10,User::dtsCampaign_Code11,User::dtsCampaign_Code12,User::dtsCampaign_Code13,User::dtsCampaign_Code14,User::dtsCampaign_Code15,User::dtsCampaign_Code16,User::dtsCampaign_Code17,User::dtsCampaign_Code18,User::dtsCampaign_Code19,User::dtsCampaign_Code2,User::dtsCampaign_Code20,User::dtsCampaign_Code3,User::dtsCampaign_Code4,User::dtsCampaign_Code5,User::dtsCampaign_Code6,User::dtsCampaign_Code7,User::dtsCampaign_Code8,User::dtsCampaign_Code9

    I think this is really close to working now! I am really grateful

  • i guess you are missing the attachment.

  • sorry error attached now:

  • It looks like it is timing out when trying to set the first value in the form to my dts variable dtsCampaign_Code1?

  • Please use the below code for btnCampaignCode_Click

    void btnCampaignCode_Click(object sender, EventArgs e)

    {

    foreach (TextBox inputBox in txtCampaignCode)

    {

    string variable = "dts" + inputBox.Name.Replace("txt", "");

    // Now you can use the variables

    if (inputBox.Name.ToString().Substring(3, (inputBox.Name.ToString().Length) - 3) == variable.ToString().Substring(3, (variable.ToString().Length) - 3))

    {

    int number;

    if ((int.TryParse(inputBox.Text, out number)) == true)

    {

    Dts.Variables[variable].Value = Convert.ToInt32(inputBox.Text);

    }

    // if DTS varibale is of type String

    // Dts.Variables[variable].Value = inputBox.Text.ToString();

    }

    }

    frm.Close();

    }

  • rxm119528 just wanted to say this is now working great and doing exactly what I need it to do. I will have to go on a C# course

    Thanks so much for being so generous with your time

    Best Wishes from the UK

Viewing 6 posts - 16 through 20 (of 20 total)

You must be logged in to reply to this topic. Login to reply