title: Is it bad practice to catch the "happy path" in an exception?
body: <p>I have an SQL statement that checks to see if a value is in my database or not. I want to respond with the "happy path" if the value is <em>not</em> in the database.
  I have found using DbDataReader (.NET) that if a SELECT query can't find the value it throws an exception - so my "happy path" ends up in the exception, not in the main try block.</p>
  
  <p>I can always say "NOT IN" but I don't want to return all of the rows in the database that don't have the value - as this would return many thousands of results where as all I want is just a "no it is not here" type response.</p>
  
  <pre><code>public void wristbandScan(string barcode)
      {
          string query = "SELECT ticket FROM tickets WHERE 
                               linked_barcode='" + barcode + "'";
  
          ValidTicketEventArgs args = new ValidTicketEventArgs();
  
          try
          {
              var queryResult = _dbRunner.queryThis(query);
  
              args.Result = false;
              args.Message = "WB already linked";
              args.Barcode = barcode; 
              OnValidTicketEvent(args);
          }
          catch (Exception e)
          {
              this.updateWristband(barcode);
              this.updateValid();
              args.Result = true;
              args.Message = "WB linked";
              args.Barcode = barcode;
              OnValidTicketEvent(args);
          }
      }
  </code></pre>
  
  <p>It feels wrong to me to catch the happy path in an error statement, but I do not want the lag associated with reading in all the rows with the NOT IN statement.</p>
  
  <p>Is there a better way to do this or is this approach acceptable best practice?</p>