 <p>You don't need an SqlDataAdapter and all the infrastructure required to work with if you just have a single value returned by your Stored Procedure. Just use ExecuteScalar</p> <pre><code>int count = 0; using (var con = new SqlConnection(connectionString)) using (var cmd = new SqlCommand("RunAStoredProc", con)) { cmd.CommandType = CommandType.StoredProcedure; count = (int)cmd.ExecuteScalar(); } Console.WriteLine(count); Console.ReadKey(); </code></pre> <p>However if your really want to use an adapter and a dataset then you can find the result of your query reading the value from the first row and first column from the returned table</p> <pre><code>int count = Convert.ToInt32(table1.Rows[0][0]); </code></pre> <p>or even (without declaring the table1 variable)</p> <pre><code>int count = Convert.ToInt32(ds.Tables[0].Rows[0][0]); </code></pre> <p>To discover the difference between the result of the first select statement and the count of rows returned in the second select statement you could write</p> <pre><code>int allStudents = Convert.ToInt32(ds.Tables[0].Rows[0][0]); int enrolledStudents = ds.Tables[1].Rows.Count; int notEnrolledStudents = allStudents - enrolledStudents; </code></pre>