Declaring a new SqlCommand will return just that, a command. What you want is the results of executing that command, and that is via the
ExecuteNonQuery
method.
But you will need more than this- your code probably won't even compile as the command you define in line #1 doesn't have the string closed, and your parenthesis are broken too. Try formatting your code, and declaring the language type when you are pasting it in and you would noticed it's boogered-up
<pre>using (SqlCommand cmd = new SqlCommand("SELECT ID FROM STUDENT EXCEPT SELECT ID FROM REGISTERSTUDENT", connection)) {
int except = cmd.ExecuteNonQuery();
if (except != 0)