YoungEngineer


Hi all,

I know how to basically change SSIS variables from within a C#. NET winform application. But can anyone point me on how to change the contents of a connection manager SSIS connection from withing C#.net please. That is..how do i parameterize a connection manager connection to basically accept the connection information from within the winform app.

Thanks





Re: Programming with c#.NET and variables

YoungEngineer


bump





Re: Programming with c#.NET and variables

jwelch

One way is to use an expression to set the ConnectionString property of the ConnectionManager. You can base the expression on a variable.

You can also set the connection manager properties directly through code, by getting the collection of connections from the package.







Re: Programming with c#.NET and variables

YoungEngineer

the problem is that i already have the ssis package...im basically creating a win form front end to mask the ssis package. in my win form im capturing the sql server connection info, and im trying to figure out how to variabalize the sql connection in the package connection manager.

i was able to do something like this easily for a flat file connection but am have no clue on how to do it for the sql connection.






Re: Programming with c#.NET and variables

Bob Bojanic - MSFT

This should not be at all harder then dealing with flat file connections. The only thing you need to do is compose your connection string and assign it to the connection manager. You might want to post your initial code here and somebody will help you.

Thanks.






Re: Programming with c#.NET and variables

YoungEngineer

well...one of the problems that i am currently running into is that the Expressionlist for an OLE DB connection does not have an assignable password field.

what that means is that when i click on my SQL connection in the Connection Manager and click the elipsis in the expression field in the properties window, I cant seem to assign a variable to the password field. Seems like i can assign an initial catalog, username and servername..but without being able to assign the password field to a variable im not sure how to proceed.

suggestions anyone






Re: Programming with c#.NET and variables

Phil Brammer

YoungEngineer wrote:

well...one of the problems that i am currently running into is that the Expressionlist for an OLE DB connection does not have an assignable password field.

what that means is that when i click on my SQL connection in the Connection Manager and click the elipsis in the expression field in the properties window, I cant seem to assign a variable to the password field. Seems like i can assign an initial catalog, username and servername..but without being able to assign the password field to a variable im not sure how to proceed.

suggestions anyone



You add the Password parameter to the ConnectionString. Typically I build a variable that is used to build a dynamic connection string, and then I just reference that variable in the connection manager's expression property for ConnectionString.





Re: Programming with c#.NET and variables

YoungEngineer

is the password field in the connectionstring just called "password"

Data Source=localhost;User ID=myUser;Initial Catalog=test;Provider=SQLNCLI.1;Persist Security Info=True;Auto Translate=False;






Re: Programming with c#.NET and variables

jwelch

Yes.