title: Get number of rows in a SQL Server table in VB.NET
body: <p>There are 10 rows in <code>primary_student_table</code>.</p>
  
  <p>When I execute the following code, the result was -1.</p>
  
  <pre><code>Dim count As Int16
  con.Open()
  query = "SELECT COUNT(roll) AS rollcount FROM primary_student_table WHERE admityear = 2011 AND batch = 1 "
  
  cmd = New SqlCommand(query, con)
  
  count = cmd.ExecuteNonQuery
  MsgBox(count)
  
  con.Close()
  </code></pre>
  
  <p>What's the problem in the above code?</p>