Change Path of Files (.mdb, .xls, .txt)

  • Hi, (sorry for my english, I'm from Switzerland)

    I need to change the DataSource of several files in several Packages (Child) from another Package.

    I can read the Datasource, but can't overrite/save it.

    It doesn't notice an Error, but there's still the old Path.

    Any Help?

    T

    Function Main()

    Main = DTSTaskExecResult_Success

    svr = "svr

    uid = ""

    pwd = ""

    Set oDTSApp = CreateObject("DTS.Application")

    Set oGetPkg = oDTSApp.GetPackageSQLServer(svr, uid, pwd, DTS.DTSSQLServerStorageFlags.DTSSQLStgFlag_UseTrustedConnection)

    Set cPkgs = oGetPkg.EnumPackageInfos("", True, "")

    Set pack = CreateObject("DTS.Package")

    For Each oPkg In cPkgs

    desc = oPkg.Description

    msgbox "Description:" + desc

    If InStr(desc, "LA_") <> 0 Or InStr(desc, "LU_") <> 0 Then

    pack.LoadFromSQLServer svr, uid, pwd, DTSSQLStgFlag_UseTrustedConnection , "", "", "", oPkg.Name

    'GO THROUG THE GLOBAL VARIABLES, THE LAST IS THE CONNECTION NAME

    For Each v in pack.GlobalVariables

    msg = v.Name

    Next

    Set oConn = pack.GlobalVariables.Parent.Connections("" + msg)

    'THIS SHOWS THE RIGHT PATH OF THE FILE

    msgbox "Path: " + oConn.DataSource

    'CAN'T OVERWRITE IT

    oConn.DataSource = "Test"

    msgbox "Packagename:" + oPkg.Name

    Else

    msgbox "Not a LA or LU Package!"

    End If

    Next

    Set oGetPkg = Nothing

    End Function

  • in short:

    i want to change connections properties in a child package with active x.

    thx

Viewing 2 posts - 1 through 1 (of 1 total)

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