I've consulted in more than my fair share of Integration Services (SSIS) engagements over the last year or so since Yukon hit the streets. (Don't get me wrong, I love SSIS! But... I'd like to write some MDX every once in a while, if you know what I mean.) In every single SSIS engagement, I've been seeing a trend in Script Task and Script Component coding that concerns me. I'd like to point out that there's a "better way" IMNSHO.
For whatever reason, .NET developers seem to know only the System.Data.SqlClient namespace backwards and forward – which leads them to use it in Script Tasks & Script Components. The SqlClient classes rock! They're my preference in pure, nothing-but-.NET code. However, which co-mingled with SSIS, this causes one of two goofy things (or both) to happen:
Instead of doing one or both, why not just stop using the SqlConnection, SqlCommand and SqlDataAdapter inside SSIS Script Tasks, Script Components and custom components? A few simple changes to your script code (and custom task code!) will simplify all this to having to manage only ONE copy in ONE format of your connection string. Start with this one little change:
The System.Data.OleDb namespace is so similar to the SqlClient namespace that the only changes that will probably be required in your code is a Find-and-Replace of SqlClient with OleDb to leverage the equivalent power of the the OleDbConnection, the OleDbCommand and the OleDbDataAdapter. Here's an example. [Pardon my C# that came from a custom component for populating a strongly-typed dataset.]
OleDbConnection cnx = new
OleDbCommand cmd = new
cmd.CommandType = CommandType.StoredProcedure;
OleDbDataAdapter oda = new
As always, this is just my opinion, not an official pronouncement by anyone but me, and YMMV. Keep it fun!