UDL Path

  • Hi guys

    I have an application which is to use a UDL, but what I would really like is to be able to pass the location of the udl to the package and change it programatically.

    I have been able to do this with other data sources such as XL with the commands

    Set oConn = DTSGlobalVariables.Parent.Connections("Microsoft Excel 97-2000")

    oConn.DataSource = DTSGlobalVariables("Filename").Value

    however within the UDL, the data source is UDL, not the path to the UDL. Does anyone know how/if I can change this and if so what the syntax would be

    thanks in advance

    Ross Carr

  • Ross,

    Take a look at this sample: http://www.sqldts.com/default.aspx?241

    Hope it helps,

    Darrell

  • hi darrell

    have been through these with no luck to date

    can easily change the standard properties, what i need is a way to change the path to the UDL

    thanks anyway

    Ross

  • Ross,

    Try this:

     Set oCn = DTSGlobalVariables.Parent.Connections("MyUDLTest")

     oCn.UDLPath = fully qualified path & "MyUDL.udl"

  • I use this code when I need to use a UDL file to instantiate a connection...

     Dim oConn, sUDLFile

    sUDLFile =  DTSGlobalVariables("gsPubsUDL").Value

    Set oConn = CreateObject("ADODB.Connection")

    oConn.Open "file name=" & sUDLFile

    Here, the gsPubsUDL global variable contains the fully qualified path with the UDL file name.
     
    You can always dynamically pass in a value to the gsPubsUDL using an ini or XML file.
     
    The other option, if you have a Data Link connection in your package that needs to point to the correct file, is to simply use the Dynamic Properties task to update the connections UDL File property.

    Rushabh Mehta

    SQL Server MVP
    Solid Quality Learning

  • Cheers DSP

    Works like a charm...you have no idea how long I have spent on that!!!

    wouldn't it be nice if it was called the same as on the screen!

     

    cheers m8

    Ross

Viewing 6 posts - 1 through 5 (of 5 total)

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