title: How do I count the number of rows returned in my SQLite reader in C#?
body: <p>I'm working in Microsoft Visual C# 2008 Express and with SQLite.</p>
  
  <p>I'm querying my database with something like this:</p>
  
  <pre><code>SQLiteCommand cmd = new SQLiteCommand(conn);
  
  cmd.CommandText = "select id from myTable where word = '" + word + "';";
  cmd.CommandType = CommandType.Text;
  SQLiteDataReader reader = cmd.ExecuteReader();
  </code></pre>
  
  <p>Then I do something like this:</p>
  
  <pre><code>if (reader.HasRows == true) {
      while (reader.Read()) {
          // I do stuff here
      }
  }
  </code></pre>
  
  <p>What I want to do is count the number of rows <em>before</em> I do "reader.Read()" since the number returned will affect what I want/need to do.  I know I can add a count within the while statement, but I really need to know the count before.</p>
  
  <p>Any suggestions?</p>