In C# using ado.net, how to know just the number of rows that may be returned by a SQL Server select stored procedure without returning the result set and without changing the stored procedure?
I don’t want to read the data at all, I only want the number of rows because the load can consume a lot of memory.
I’d originally thought that .ExecuteNonQuery() would do it. But since it doesn’t work for SELECT statements, the DataReader will probably be your best (fastest) bet.