title: Connect to SQL database inside Script Task in SSIS
body: <p>Inside of a Script Task in SSIS, I need to make a call to an SQL database. I have a connection string that was created when I added the database to the data sources folder, however now I'm not sure how to reference it inside the C# code. I know how to do this in the code behind of an ASP website, however it seems that SSIS should have a more direct method. </p>
  
  <p>EDIT</p>
  
  <p>This line of code actually winds up throwing an exception: </p>
  
  <pre><code>sqlConn = (System.Data.SqlClient.SqlConnection)cm.AcquireConnection(Dts.Transaction);
  </code></pre>
  
  <p>It reads: "Unable to cast COM object of type 'System._ComObject' to class type 'System.Data.SqlClient.SqlConection.'"</p>