1
votes

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?

1
Please don't ask the same question over and over.John Saunders
@John Saunders, if i am able to find solution i will not repeat the question ..! i am trying my level best to make the question easier and get the solution .. ! i appreciate if you can provide a suggestion rather than abusing ..!goofyui
you need to read the faq. Duplicate questions will be closed. Please try to learn how the site works.John Saunders
Thank you for your advise ..! Both questions are similar but different in their approach ..! This question carries passing actual connection string from C# Source Code to the Variable - ConnectionString ..! And the previous question carries .. passing values to Connection string - i.e) Sending ServerName, Database, Password .. ! I am keep reading blogs to find the solution..! Please encourage beginners to find the solutions from these technology blogging sites ..!goofyui

1 Answers

1
votes

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.