Home Forums Data Warehousing Integration Services how to read contents of flat file in SSIS and extract from it just one value for use in variable? RE: how to read contents of flat file in SSIS and extract from it just one value for use in variable?

  • Hi Sam, script task parses with your script and even turns green. how to check the value returned?

    Also, not completely sure it's ok because inside Edit Script there are areas of the script where I see 'squiggly red lines'

    Here's what I did.

    I copied the contents of just the script from the link into the Script task.

    From

    using System;

    using System.Data;

    using Microsoft.SqlServer.Dts.Runtime;

    using System.Windows.Forms;

    To

    // Finish and return success

    Dts.TaskResult = (int)ScriptResults.Success;

    }

    }

    }

    and made edits on these lines.

    String filter = (string)Dts.Variables["FilterValue"].Value;

    String FileName = (string)(Dts.Connections["manifestFF"].AcquireConnection(Dts.Transaction) as String);

    Dts.Variables["RowCount"].Value = returnvar;

    But I'm getting this error when I hover over the squiiglies:

    Cannot apply indexing with [] to an expression type Microsoft. SQLServer.Dts.Runtime.Variables

    other info

    I have created a FF connection called manifestFF and in SSIS Variables:

    FilterValue as String = *settings_campaign.txt*

    RowCount as Int32 = 0

    In script task I defined

    User::FilterValue as the ReadOnlyVariable

    User::Rowcount as the ReadWriteVariable.