title: If values exist; Do not input values. if statement
body: <p>Beginner here experimenting. I have written a small code snippet that enters data from a txt file into a database. As the question states, I want to write an if statement (I think), that checks for duplicates and if there is a duplicate, prevent data entry. Or maybe if the values exist, then donotprocess();, something to that extent. </p>
  
  <p>Im having a little trouble getting started, so if someone could provide some insight or point me into the right direction I would greatly appreciate it. </p>
  
  <pre><code>    public bool UpdateOrderTrackingNumber(string tracking)
  {
      trackingNumber = tracking;
      string statement = "INSERT INTO SOP10107 VALUES(@SOPNUMBE, @SOPTYPE, @Tracking_Number);";
      SqlCommand comm = new SqlCommand(statement, connectionPCI);
  
      comm.Parameters.AddWithValue("SOPNUMBE", orderNumber);
      comm.Parameters.AddWithValue("SOPTYPE", soptype);
      comm.Parameters.AddWithValue("Tracking_Number", tracking);
      try
      {
          comm.Connection.Open();
          comm.ExecuteNonQuery();
          comm.Connection.Close();
      }
      catch (Exception e)
      {
          comm.Connection.Close();
          KaplanFTP.errorMsg = "Database error: " + e.Message;
      }
  
      return true;
  }
  </code></pre>