Database Reference
In-Depth Information
Dts.Connections["Conn_Name"] ). I strongly recommend against this practice!
It makes for rather ambiguous connection references, and since the order of connection
managers cannot be guaranteed, you might end up with a runtime error at best—and at
worst, wildly unexpected behavior in your package.
Using Connection Managers in the Script Component
As I mentioned in the previous section, many of the same concepts apply to the reuse
of connection managers, whether you're working in the Script task or the Script com-
ponent. For the same reasons, it's almost always a best practice to reuse an existing
connection manager object (or create a new one if necessary) rather than to build a con-
nection object from scratch within code.
Logistically, connection managers are a little easier to use in the Script component.
Because the purpose of this tool is to move data (which is not always the case with the
Script task), some additional functionality comes baked in to make the job of reusing
connection managers less cumbersome. In the Script component, you can declare the
use of one or more connections within the script's graphical editor (much like you de-
clare the use of read-only or read-write variables, to be discussed shortly). As shown in
Figure 3-8 , this interface allows you to easily reference an existing connection.
 
Search WWH ::




Custom Search