title: SQL Find Value in Database, return if true or not and if true Count if there is duplicate
body: <p>I'm making a query that the title implies.</p>
  <p>Currently I have this code. My SQL Query:</p>
  <pre><code>SELECT COUNT(*) AS CountOf
  FROM     Personnel
  WHERE  ([First Name] = @FirstName) AND ([Middle Name] = @MiddleName) AND ([Last Name] = @LastName)
  GROUP BY [First Name], [Middle Name], [Last Name]
  HAVING (COUNT(*) &gt; 0)
  </code></pre>
  <p>and C# code:</p>
  <pre><code>private void button2_Click(object sender, EventArgs e)
  {            
      int i = 0;
      string LastName;
      string FirstName;
      string MiddleName;
      while (i &lt; myDataGridView.Rows.Count - 1)
      {            
          DataGridViewRow r = myDataGridView.Rows[i];
          LastName = r.Cells[0].Value.ToString();
          FirstName = r.Cells[1].Value.ToString();
          MiddleName = r.Cells[2].Value.ToString();
      
          if (queriesTableAdapter.FindEncoded(FirstName, MiddleName, LastName) == null)
          {
              r.Cells[3].Value =  &quot;Not-Encoded&quot;;
          }
          else
          {
              r.Cells[3].Value = &quot; Encoded &quot; + queriesTableAdapter.FindEncoded(FirstName, MiddleName, LastName);
          }
          i++;                
      }            
  }
  </code></pre>
  <p>The query doesn't loop well. It returns <code>false</code> after the 1st loop (manually checked all data are encoded).</p>