title: Proper use of try/catch in SSIS C# Script Component to skip failed DB inserts
body: <p>Just starting to get up to speed with SSIS error handling. We are using a Script Component as a final step in our Data Flow.  In the Input0_ProcessInputRow method, I am assigning values to the parameters of a stored procedure.  Some of the data being passed fails validation (referential integrity, etc.) and cannot be inserted.  Long term, I wish to log those failures so we can review them later.  Right now, the issue is, once we hit one of these records, the entire SSIS step fails.  No records get added.</p>
  
  <p>I wrapped the code in a try/catch expecting the failing records to just be skipped and move on to the next one.  </p>
  
  <pre><code>public override void Input0_ProcessInputRow(Input0Buffer Row)
  {
      try
      {
          sqlCmd.Parameters["@FIRSTNAME"].Value = Row.DRIVERFIRSTNAME;
          sqlCmd.Parameters["@LASTNAME"].Value = Row.DRIVERLASTNAME;
          sqlCmd.Parameters["@STATUS"].Value = "Active";
          sqlCmd.Parameters["@SHOPID"].Value = Row.DRIVERSHOPID;
          sqlCmd.Parameters["@ADDRESS1"].Value = Row.DRIVERADDRESS1;
          sqlCmd.Parameters["@ADDRESS2"].Value = Row.DRIVERADDRESS2;
          sqlCmd.Parameters["@CITY"].Value = Row.DRIVERCITY;
          sqlCmd.Parameters["@STATE"].Value = Row.DRIVERSTATE;
          sqlCmd.Parameters["@ZIPCODE"].Value = Row.DRIVERZIPCODE;
  
          sqlCmd.ExecuteNonQuery();
      }
      catch (Exception ex)
      {
          //bool pbCancel = false;
          //this.ComponentMetaData.FireError(0, "SQL Task", "An error occurred: " + ex.Message, "", 0, out pbCancel);
      }
  }
  </code></pre>
  
  <p>Many of the examples I find are for VB and are pretty old.  So far, none that I try have worked.</p>
  
  <p>How do I skip the failing records and allow the others to proceed?</p>