changing config file variable with script

  • hi

    i have a config file and a script task that aims to change one of the variables within it

    Public Sub Main()

    Dim vars As Variables

    Dts.VariableDispenser.LockOneForWrite("varBusinessDay", vars)

    vars(0).Value = #1/3/2009#

    vars.Unlock()

    Dts.TaskResult = Dts.Results.Success

    End Sub

    it runs ok, but when i look at the variable afterwards, it's still the old value and indeed if i open the config file in notepad, it's still the old value too

    i haven't got the ReadOnly property set to truein the config settings...but it appears it's impossible to change the config file without doing it in notepad

    ideally i want my script to work...any ideas?

  • Did u try assigning to the Config variable specifically:

    Dts.Variables(" ").Value.ToString()

  • Either I do not understand what you are trying to do, or you do not understand configuration files.

    The configuration file is applied when the package first starts running. Any properties, settings, or variables in the configuration file are applied appropriately in the package and then the package it run. Once the package has pulled the values from the configuration file at the start, the configuration file is not accessed again. Your package will not write anything back to the configuration file - the file is there to configure the package, not as a container for output or any kind of package feedback.

  • Michael Earl (2/3/2009)


    Either I do not understand what you are trying to do, or you do not understand configuration files

    aah, it's me not understanding config files and still trying to keep something dynamic in there

    think i've got it now

    thanks

Viewing 4 posts - 1 through 3 (of 3 total)

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