The ExecuteNonQuery method will call "ExecuteReader" and immediately call "Close" on the returned reader object. ExecuteScalar will call "Read" once, pick out the first value (index 0) and then call "Close".
Since the DataReader is essentially nothing more than a specialized network stream, any information that is returned afther it's current location (when Close is called) will just never reach the actual client components, even though the server might have sent it. The implementation is as such to avoid returning a huge amount of data when none is required.
In your case, I see two solutions to this problem.
make sure that you use ExecuteReader instead, and read all the way through the result:
using(var reader = command.ExecuteReader()) { do { while (reader.Read()) { /* whatever */ }; } while (reader.NextResult()); }
If you can control the server side, it will help to move the actual "send-to-client" select to the end of the procedure or batch in question. Like this:
create proc Demo as declare @result int select top 1 @result = Id from MyTable where Name = 'testing' print 'selected result...' select @result Id -- will send a column called "Id" with the previous value go