Connection string building is vital task for programmer to connect to a database server in Script Task. of course, there is a website that has pre-defined connection strings for all database servers. You can browse connectionStrings here.
But, In this article I will show you how to read the connection string from the connection manager in script task.
Step 1: Create a SSIS package
Step 2: Add a OLE DB connection and connect to your Microsoft SQL Server server.
Step 3: Add a script task and go to script window and the following code.
Public Sub Main()
‘
‘ Add your code here
‘ Statement to get connection string
MsgBox(Dts.Connections(“MyConnection”).ConnectionString)
Dts.TaskResult = ScriptResults.Success
End Sub
Step 4: execute the package
Thanks for reading.








