goofyui
goofyui

Reputation: 3492

Passing connection string from C# to SSIS package

From my C# code, I am executing the SSIS package. I have to pass a source file (.csv) and destination connection (SQL database) from C# to SSIS as input parameters.

In SSIS, I have a simple Data Flow Task which has a Flat File Source connected to OLEDB Destination File.

How should I pass a dynamic connection string to my SSIS Package?

Upvotes: 1

Views: 4383

Answers (1)

cairnz
cairnz

Reputation: 3957

Use the Connection String Builder to construct a proper connection string:

http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnectionstringbuilder.aspx

Then create two variables of type string in your ssis package, and set expressions on your flat file source and oledb to use these variables as "ConnectionString".

Then when you execute the SSIS package, you will assign the two variables values from your ConnectionStringBuilder from above.

Upvotes: 1

Related Questions