title: Pass SSIS parameters from C#
body: <p>I have an SSIS package which has some Project.params set.</p>
  
  <p>How do I pass values for those parameters to the SSIS package via C#?</p>
  
  <p>I'm trying the following:</p>
  
  <pre><code>const string pkgLocation = @"export.dtsx";
  var app = new Application();
  var pkg = app.LoadPackage(pkgLocation, null);
  
  var results = pkg.Execute();
  </code></pre>
  
  <p>This returns a failure, with Errors collection containing "The variable "$Project::connString" was not found in the Variables collection. The variable might not exist in the correct scope."</p>
  
  <p>So I tried adding</p>
  
  <pre><code>var param = pkg.Parameters.Add("connString", TypeCode.String);
  param.Value = "test"; 
  var results = pkg.Execute();
  </code></pre>
  
  <p>But this throws a DtsGenericException.</p>