Adding Connection string to SSIS package dynamically

  • Hi,

    I am new to SSIS and i have to develop a ssis package which has to run on a production machine through VB.Net exe (2003).I need a way to pass connection string dynamically to this SSIS package.Can anybody help me on this?

  • As per my knowledge we can dynamically change the connection strings using Configuration(.Config) files.

  • If you are running the SSIS package from within VB code you can setup variables within the SSIS package, use those variables to build the connection string in the SSIS package and then set the variables just before you run the package form within VB

    Do a search on SSIS dynamic connection string variables and you should come up with something useful

    e.g.

    Dim pkg As String = "MyPackageName.dtsx"

    Dim pkgResults As DTSExecResult

    Dim app As Microsoft.SqlServer.Dts.Runtime.Application = New Microsoft.SqlServer.Dts.Runtime.Application()

    Dim p As Microsoft.SqlServer.Dts.Runtime.Package = app.LoadPackage(pkg, Nothing)

    Dim pkgVar As Variables = p.Variables

    pkgVar("VarInputDataSource").Value = "Q:\Data\MyFileName.txt"

    pkgVar("VarDatabaseName").Value = gClientDBConnection.DBName

    pkgVar("VarServerName").Value = gClientDBConnection.ServerName

    pkgResults = p.Execute()

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

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