Using connection manager with in script task to get the file name

  • Hi,

    I need to get the file name of a connection manager with in a script component. I added the connection manager to the script component and within the script, as suggested by microsoft I used the following code.

    Dim myFlatfileConnectionManager As IDTSConnectionManager100 = _

    Me.Connections.MyFlatfileConnection

    I get an error message that 'MyFlatfileConnection' is not a member of SC_xxxx.vbproj.connections

    Can any one tell me if I need to do some thing more to get this to work.

    Thanks for your time.

    Peter Kennedy

  • What are you wanting to do with the filename? Have you thought about using package variables to get it in there instead of trying to access the connection manager properties through the script componnet?

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • Try this:

    Dim FlatCon As ConnectionManager = Dts.Connections("MyFlatFileConnection")

    MsgBox(FlatCon.ConnectionString)

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • I apologize for not getting back to you. I tried your suggestion and I am getting an error message saying connectionmanager is not defined.

    Any ideas.

    Thanks.

    Peter

  • Hi,

    I finally figured it out.

    Don't ask me why but apparently you can only use the "DTS" stuff with in a script TASK not with in a script component.

    I used the following code from the microsoft website.

    Dim myFlatFileConnection As String

    myFlatFileConnection = _

    DirectCast(Dts.Connections("Test Flat File Connection").AcquireConnection(Dts.Transaction), _

    String)

    MsgBox(myFlatFileConnection, MsgBoxStyle.Information, "Flat File Connection")

    Note : Msgbox didn't work so I had to change it to MessageBox.show(myFlatFileConnection)

    Thanks

    Peter

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

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